Using URL Parameters to Drive Dynamic Content on Landing Pages | Community
Skip to main content
Level 3
November 17, 2015
Question

Using URL Parameters to Drive Dynamic Content on Landing Pages

  • November 17, 2015
  • 5 replies
  • 3903 views

We use Marketo for all of PPC landing pages and in Russia we need to tailor these landing pages to the different regions.  Most of the content on the page will stay the same, but we would like to regionalize with the regions name, city list and a map.  Instead of creating hundreds of variations of our landingpages we though we could create one set and based on URL parameters (i.e. pages.vj.com/landing.html?region=Moscow&cities=Moscow%20%Leningrad&map=msocow.jpg) change the content of the page.

I was thinking of using Program tokens but don't know if they can be dynamically set. 

Should I just use Javascript instead?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

5 replies

Grégoire_Miche2
Level 10
November 17, 2015

Hi Tim,

Indeed, you will need to use some JS to do this. You will have to extract the info form the URL and then inject it in the page, on specific places (usually using classes or IDs to identify the places where to inject the data).

-Greg

November 17, 2015

Program tokens can be dynamically set via API so that is an option.  The best way to do this is by making the Landing Pages dynamic via segmentation or via tokens. 

Grégoire_Miche2
Level 10
November 17, 2015

Hi Jamie,

as we are talking here about PPC campaigns, the information is probably set by the banner or paid add on which the visitor has clicked, not form an email sent from Marketo (in which case we might also consider using lead tokens).

-Greg

SanfordWhiteman
Level 10
November 17, 2015

But you can still use segmentations, forcing the segment in the URL. I'd say this is probably easier for people who are used to the Marketo LP Editor experience.

Robb_Barrett
Level 10
November 18, 2015

You'll need to create or modify a page template to get the code in you need.

In your header of your template, you'll want this:

<script type="text/javascript">

function getUrlVars() {

    var vars = {};

    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi,

    function(m,key,value) {

      vars[key] = value;

    });

    return vars;

  }

var map = getUrlVars()["map"];

var region = getUrlVars()["region"];

var cities= getUrlVars()["cities"];

</script>

Now, in your HTML, where you want the stuff to appear, put this in:

Map:

<img id="map-img">

      <script>

  var mapimg = map;

  document.getElementById("map-img").src = mapimg ;            

      </script>

Cities:

<ul id="itemList"></ul>

<script>

var itemsExist = true;

var indexNum = 0;

var unorderedList = document.getElementById('itemList');

var str = cities;

var res = str.split("%20%");

var myElement;

function write_cities() {

    for (i = 0; i < res.length; i++) {

        // Create the <LI> element

        myElement = document.createElement("li");

        // Add the letter between the <LI> tags

        myElement.appendChild(document.createTextNode(res[indexNum++]));

        // Append the <LI> to the bottom of the <UL> element

        unorderedList.appendChild(myElement);

    }

}

if (itemsExist) {

    write_cities();

}

</script>

Region:

<p id="Region-Name"></p>

      <script>

  var regionname = region ;

  document.getElementById("Region-Name").innerHTML = regionname;            

      </script>

Robb Barrett
Level 10
November 19, 2015

Hi Tim, Yes, you can do this very easily by using the segmentation. Here are the example URL's info2.filemaker.com/FileMaker_Platform_Trial_Request.html?Language=EN info2.filemaker.com/FileMaker_Platform_Trial_Request.html?Language=FR In the above URL's content is regionalize on the basic Language Parameter and it setup using the segment only, if you want can use the tokens also with the segments. Let me know, if you need more info on this. Regards, Alok

Mike_Reynolds2
Level 10
November 19, 2015

Tim,

This can actually be done very easily with Real Time Personalization (RTP). It's a product that Marketo offers and the basic function is to dynamically change your page content depending on which visitors view the page. Using URL parameters is just one of a large number of ways you can identify audiences, but you can also use geo-location through reverse IP lookup, lead data integrated from Marketo and a wide variety of other options as well. Once the audience is identified you can create custom content for each audience, all within the same one page. So, you have one web page and unlimited ways to dynamically change the content on it. Talk to your Customer Account Manager and I'm sure they'll have lots of information available on RTP