Skip to main content
Adding Cookies to Page 1 on a Two Page Campaign
Support avatar
Written by Support
Updated over a week ago

October 29, 2010
Updated: March 1, 2020

On a Two Page Campaign, Platform will not send you the data back that the user entered on page 1 when the code gets to the second page, as it behaves on the success URL. However, in some special instances, you may need to retrieve that data.

One way to accomplish retrieving data from page 1 is by setting a cookie when the user is done entering each field. This way, the second page will grab that data for custom programming scripts that you may have in your side, using that initial prospect information.

These cookies will expire when the browser is closed.

Modifying Page 1 on your Two Page Campaign: 

On any field you wish to capture add this event as an attribute to the input:

onblur="document.cookie = + '=' + this.value + '; path=/';"

Below here is an example capturing “fields_phone”. Since the "ID" of the field is called "fields_phone", your cookie index will be called "fields_phone" on page two when you try to retrieve the value the user entered.

<input type="text" onkeydown="return onlyNumbers(event,'phone'')" id="fields_phone" onblur="document.cookie = + '=' this.value + '; path=/';" name="fields_phone" />

Retrieving the value of your set cookies on Page 2: 

On page 2, using PHP $_COOKIE super global, you then can take in each HTML field that you captured from page 1 and use them however you need to use them with other custom programming you may have.

Just add this below the <?php block:

NOTE: In order to prevent issues with cookies dropping out of the transaction, ensure that in all exit-pop URLs or success URLs that your domain is the same domain, and also it is very important to ensure that the traffic always is sent to a consistent domain such as Your exit-pop or success pages should be and NOT Doing so will result in the cookie domain being different and thus will be all null values across the two different domains.

Did this answer your question?