Sharing variables between several landing pages


#1

Hi,

I have 3 landing pages (A, B and C) that can be called from within an e-mail. Each of these landing pages can link to each other (e.g. within A you can link to B or C and back if you want). Also I have 1 landing page with a form that can be called from each one of these three landing pages (D). None of the landing pages A, B and C have a form.

The question is as follows: I want to pre-fill the form fields of D with personal data of the person to whom the e-mail was sent. I can add URL variables in the calls to A, B and C, but I can’t do that for D since D is not called from within the e-mail. The question therefore is: how can I share these personal data between A,B, C and finally D?

I was thinking of doing this with a cookie, but this is not 100% failsafe (blocked cookies). Does anyone have a solution for this problem, if possible some experience?

Many thanks in advance!


#2

You could use some custom javascript that takes any URL parameters supplied to the page and adds them to any links that are on the page. You can add custom Javascript by clicking on the scripts button on the page. Try pasting in the following:

<script> <br />
$(document).ready(function() { <br />
  var params = window.location.search; <br />
  var button = $('a').each( function(i) { <br />
    this.href = this.href + params; <br />
  }); <br /><br />
}); <br /> </script>   
 

#3

Hi Justin,

Thanks, this is exactly what I was looking for!
A very simple and elegant solution by the way…


#4

Hi Justin,

I have one more question about this. Is it possible to replace some characters in the url parameters BEFORE they are used to pre-fill the form fields?
The URL called from within the email is e.g. of the form abc.com?lastname=Van+de+perre (spaces replaced by +). I would like this to be lastname=Van%20de%20perre so that pre-filling the form fields would show the name with spaces (Van de perre) and not with + characters (Van+de+perre).

Kind regards
Marc


#5

Use javascript’s String.replace method like this:

<script> <br />
$(document).ready(function() { <br />
  var params = window.location.search.replace(//g,'%20'); <br />
  var button = $('a').each( function(i) { <br />
    this.href = this.href + params; <br />
  }); <br /><br />
}); <br /> </script>   

#6

Hey Marc!

We added the ability to pass incoming URL parameters to your click through button links. No need to include javascript. Simply check off a box in your buttons properties. Check out the support article below for further details.

http://support.unbounce.com/entries/2…

Keep in mind this only works for button links. If you have text links you wish to pass those parameters into then you’ll want to continue using Justin’s script