OpenX Tips- How to pass custom site variables to landing pages and get them included in the form submit - Part2?

| | 1 min read

We have already seen how to pass banner ad attributes to landing pages and also how to how to pass custom site variables to landing pages in our previous articles. Now, how can we get them included in the form submit of a landing page and get them emailed along with the lead. Here is how we can do it.

Follow these steps in your landing page corresponding to your ad.

1. Created a hidden field

Name: Zone
Default value: zone

2. Add Custom Script to set the variable passed through ad URL as the value of the hidden field.

<script type="text/javascript">
$(function() {
  var paramMap = {};
  if (location.search.length == 0) {
    return paramMap;
  }
  var parts = location.search.substring(1).split("&");
  for (var i = 0; i < parts.length; i ++) {
    var component = parts[i].split("=");
    paramMap [decodeURIComponent(component[0])] = decodeURIComponent(component[1]);
  }
  $(".lp-pom-body #banner_ad").val(paramMap.q);
  $(".lp-pom-body #zone").val(paramMap.z);
  });

</script>

3. Republished the Landing Page Variant

4. Updated all the ad URLs to look like

ad-url/?q=ad-name&z={zone-name}

e.g. http://domain.com/drupal-customization/?q=dpl_cst_200x200_Tools&z={zn}

5. Set the variable in the zone code

Hope this helps!