Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pardot Server Side Form Handler: Extract the cookie ID from the browser and pass it to the visitor_id

I'm currently working on a system to post existing forms to a Pardot Form Handler via a server side process. I've got the form posting to Pardot via WordPress' helper function wp_remote_post using the following code. (Its a CURL post at its core):

$response = wp_remote_post( 'https://ourdomain.com/l/82632/2018-04-26/544m2kc' , array(
        'timeout'   => 45,
        'body'      =>  $form_data
     )
);

However Pardot Requires a tracking cookie to be sent with the data. On site http://nebulaconsulting.co.uk/using-pardot-form-handlers/ there is the following quote:

A server-side post can also pass the Pardot browser cookie through with the data so future web activity can be tracked. This requires an extra script to extract the cookie ID from the browser and pass it to the visitor_id field in Pardot.

Does anyone have any help on how I can do this?

like image 270
magicstickuk Avatar asked Sep 15 '25 00:09

magicstickuk


1 Answers

Zachary's answer is great but I'd like to point out that the visitor_id key doesn't match up exactly with the piAId (Account Id): it's the Account ID minus 1000.

Not sure why Pardot do this but I've confirmed it with multiple instances.

So if your piAid is 315092, your visitor_id key will be: visitor_id314092

Therefore, in Zachary's example, it will be: 'visitor_id' => 'Value of visitor_id314092 cookie'

Edit: this seems to have been resolved by Pardot

like image 57
Mark Avatar answered Sep 16 '25 15:09

Mark