3

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?

magicstickuk
  • 91
  • 1
  • 8

3 Answers3

3

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'

Mark
  • 103
  • 8
1

I'm assuming the visitor has viewed a page on your website with a Pardot tracking code in place before the form submission. This sets a cookie with the visitor id, and you can retrieve its value (via JS) and include it in your server-side post to correlate it with that visitor.

  1. In the Pardot tracking code, which relates to a specific campaign (and is found in its settings), you'll see: piAId = '315092';

  2. The tracking script sets a cookie named: visitor_id315092 (i.e. visitor_id followed by the piAId value from above)

  3. Retrieve this cookie's value and include it in the form post using the "visitor_id" key (NOT visitor_id315092)

'visitor_id' => 'Value of visitor_id315092 cookie'

0

Use a hidden iframe on a thank-you page that creates a client-side submission to the form handler. Essentially, an iframe is loaded on the page as a hidden pixel. The src of the iframe is your form handler’s endpoint URL loaded with all your field data as query parameters, email at the minimum required.

Iwantha
  • 11
  • 3