Re: Dynamic content based on URL parameter

Anonymous
Not applicable

Has anyone used a URL parameter to call dynamic content in a Marketo landing page?

example - http://www.abc.com?companyname=123

Content displayed = 123 logo

My use case is:

I want to send a link with a company name embedded in a url so I can customize the landing page with companies logo.

23 REPLIES 23
Ronen-Was-SRpro
Level 7

Hi,

Is it possible to show a form in a landing page that will be changed to different languages according to the URL? For example, if the user has www.goog.com/EN

He will be shown the form in English or if the user has www.goog.com/ES he will see the same form in Spanish.

Thank you.

Ronen Wasserman
SanfordWhiteman
Level 10 - Community Moderator

The question is more about whether a single form can dynamically change languages at all. And the answer is: it can't, unless you use the Forms API (we've done this to create a single internationalized form, but it's not simple).

If you have multiple forms (different Form IDs) already separated by language, then Yes: that can be part of Dynamic Content and in turn can be selected by passing ?{Segmentation}={Segment} in the URL.

Robb_Barrett
Level 10

This might help:

The first function will pull down the value of any URL parameter you request.

function getUrlParameter(sParam)

{

    sPageURL=window.location.search.substring(1);

    var sURLVariables = sPageURL.split('&');

    for (var i = 0; i < sURLVariables.length; i++)

    {

       var sParameterName = sURLVariables[i].split('=');

       if (sParameterName[0].toLowerCase() == sParam.toLowerCase())

           return sParameterName[1];

    }

    return "";

}

var company = decodeURI(getUrlParameter("company")); //*this removes the HTML codes

function getCompanyLogo(compName) { 

var image=""; 

if (/[?&]campaignID=/.test(location.href) == false)  {  //*this tests to see if the parameter exists

    image = "http://www.path-to-default.com/image.jpg";  //*use default image

  } else {

  if (compName== "company1") {

     image = "http://path-to-image.com/company1.jpg";

} else {

     if(compName== "company2") {

     image = "http://path-to-image.com/company1.jpg";

} else {

....

}  //*close company name loop

} //*close top level test

return image; //*sends back the correct URL

var image = document.createElement("img");  //*create an image DOM
image.setAttribute("src", getCompanyLogo(company)); //*Set the image as the URL selected
document.getElementById("your-empty-div").appendChild(image); //*Put the image in the DIV

Robb Barrett
SanfordWhiteman
Level 10 - Community Moderator

Robb, you don't need any JS for a dynamic (temporary) segmentation. The URL is parsed on the server.

(Also, that JS will break on some well-formed URLs, but that's another issue.)

Anonymous
Not applicable

Hi Jason,

I was just wondering if you ever got this to work? We want to do something similar and use a URL parameter to pull dynamic content on our landing pages. We have several different pages for companies we work with and instead of having to create unique pages for each company, we want to use vanity urls that direct to one dynamic landing page.

We would pass their company name in the URL and display their name on the page. For example, welcome XYZ company employee.

Any help or advice on this would be great! Thanks!

SanfordWhiteman
Level 10 - Community Moderator

Two major ways to do this:

  1. The segment mechanism I illustrated above.  Do this if the personalized content cannot be easily derived from the company name, or if you are not comfortable with JavaScript.
  2. JavaScript that parses the URL and replaces content that you have marked off in the HTML, i.e. <SPAN data-replace-query-param="company">{Company Name}}</SPAN>
Anonymous
Not applicable

Thanks Sanford. The JavaScript will definitely work for pages where we are just pulling in the company name.

Just one quick question about defining the segment rules. Since the lead will be unknown, we are thinking of passing the company name in the URL and using that field to assign them to the right segment. We created a segment that looks for "original referrer" contains XYZ company. Does this sounds like the best way to set this up? Thanks!

SanfordWhiteman
Level 10 - Community Moderator
Since the lead will be unknown, we are thinking of passing the company name in the URL and using that field to assign them to the right segment. We created a segment that looks for "original referrer" contains XYZ company. Does this sounds like the best way to set this up? Thanks!

The referrer is the page they came from. Original Source Info makes more sense, but this will only work if the company-tagged page is truly the first time they have ever visited your site in that browser.   I wouldn't do it either of these ways, but rather look for the specific URL of the LP contains XYZ.

Anonymous
Not applicable

Hi Sanford, thanks for your help with this. I just took a look at the segment we set up and I can't seem to find a filter that looks for the URL parameter but this is definitely the way we would want to set this up. Not sure if I'm missing something there.

SanfordWhiteman
Level 10 - Community Moderator

When you're adding a Visit Web Page trigger, one of the constraints is Query String.

Anonymous
Not applicable

So I'm seeing that the smart list to define the segment only has filters, not triggers. And there is no "visit web page" filter either.

SanfordWhiteman
Level 10 - Community Moderator

For segmentation you want to populate the field/s that the segmentation depends on using either trigger or batch campaigns. You're not directly adding to a segment but implicitly adding to a segment.

Anonymous
Not applicable

Thanks so much for your help Sanford. However, I ran a test campaign and the dynamic content did not display on the page. I'm thinking that there is not enough time for the lead to run through a campaign, then get added to a segment, and then get the right content on the LP.

SanfordWhiteman
Level 10 - Community Moderator

I feel like you're misunderstanding the design.  While you're correct that the lead will not be assigned to the segment in real time, when you pass the segment in the url -- ?company=MyCo where company is the name of a segmentation and MyCo is a segment -- the page will be dynamically segmented as if the lead were in MyCo.  There are two parts to the process: let's call it the temporary segmentation for immediate display and the permanent segmentation for later personalization when a query string is not used.

Anonymous
Not applicable

Hey Sanford, we definitely understand the design/concept of this idea but I just talked to our Marketo rep and he said this will not work. Since Marketo stopped scoring on anonymous leads, there is no way to dynamically segment the lead by passing the segment in the URL. In theory this would work well for us but I think we will have to try to use the java script option instead.

SanfordWhiteman
Level 10 - Community Moderator

Hey Sanford, we definitely understand the design/concept of this idea but I just talked to our Marketo rep and he said this will not work. Since Marketo stopped scoring on anonymous leads, there is no way to dynamically segment the lead by passing the segment in the URL.

They gave you incorrect information.  The dynamic segmentation of the page is not dynamically segmenting the lead.  As I noted above, dynamic/temporary segmentation is merely a preview.  It does not update the lead record on its own but allows you to preemptively segment content.

Here's a page using dynamic segmentation:

     http://pages.vaneck.com/localizable1.html?State=RI

     http://pages.vaneck.com/localizable1.html?State=NY

I should really blog about this because I don't think it's widely understood.

Anonymous
Not applicable

Awesome thanks we got it to work! There was some confusion there with passing the segment in the URL but we figured it out (we thought it was more complicated then it actually was.) And yes I agree, you should definitely blog about this...I think a lot of people would find it very helpful.

SanfordWhiteman
Level 10 - Community Moderator

Great, thanks for the update.

Anonymous
Not applicable

Hi Carly,

We changed direction and the project got put on the back burner. But if you follow Sanford's posts above you should be able to trigger dynamic content by using the segmentation trick.

SanfordWhiteman
Level 10 - Community Moderator

Sure, in fact you can pass a segment identifier in the URL.

     http://www.example.com?brand=123Co

will display the page as if the person were in the segment "123Co" of segmentation "brand."