Follow us on Twitter
In this script, the getURLParameter() is a function that looks for a given parameter name in the landing page URL and returns its value. Once this function with a parameter name used to pass a {trackingdomain} token is included in a click URL (what is described in the paragraph II of this guide), this click URL will use the fetched domain name once activated by a visitor.Example:Parameters in the URL are added as follows: http://lander_url.com?parameter_name1=value1¶meter_name2=value2¶meter_name3=value3thus the getURLParameter(parameter_name2) returns the value2 and getURLParameter(parameter_name3) returns the value3. It means that when you have added the parameter with the {trackingdomain} token to the landing page URL: http://lander_url.com/?m1={model}&domain={trackingdomain}the script will dynamically return exactly the same domain as for the campaign URL.Having defined the function, you can now use it in your CTA links / buttons.II. Modify the Click URL with the getURLParameter() FunctionIn a typical scenario, click URLs link to offer or offers. But if you want to have them dynamically built to include different domain names, you will have to modify them prior to pasting them on a landing page. Having two types of click URLs available in Voluum, jump to an appropriate section to learn how those links are modified. . . . . . .http://your_domain.com/clickClick URL:Take a look at the code sample below:In this case, the getURLParameter('domain') function retrieves a value that was passed in a {trackingdomain} token and the whole segment is substituted with this domain name, so the actual link will look like this:Paste this code sample on your landing page as described in the Adding Click URLs to a Lander article. . . . . . . . . http://your_domain.com/click/1http://your_domain.com/click/2http://your_domain.com/click/3Multi-offer click URLTake a look at the code sample below:In this case, the getURLParameter('domain') function retrieves a value that was passed in a {trackingdomain} token and the whole segment in each link is substituted with this domain name, so actual links will look like this:Paste this code sample on your landing page as described in the Adding Click URLs to a Lander article."}

Dynamic Click URLs with a Domain Name


This article explains how to add click URLs to the landing page that might be used in different campaign funnels. When this happens, the domain name changes, thus this piece of information should be included in a Voluum click URL. To learn more about click URLs, their types, where to get them and how to paste them on your landing page, read the Adding Click URLs to a Lander article.

The following article describes an advanced setup, where click URL are dynamically built with a correct domain name that was passed in a token added to a lander URL.

How Does It Work?

Three things need to happen to make this work:

  1. First, the domain parameter name passes a domain name in the {trackingdomain} token included in a lander URL. For more information, go to the Pass Information to a Landing Page article.
  2. Second, a script added to your landing page allow you to fetch a value (the domain name) from a given parameter name.
  3. Third, specially modified click URL or multi-offer click URLs are built dynamically with the fetched domain name.

The second and third point is described in the paragraphs below.

Voluum Note: Double-check if you have used the {trackingdomain} token in the lander's setup in Voluum. This and the code that you are about to add ensure that the domain used in the click URL / multi-offer click URL matches exactly to the domain used for the campaign URL.

I. Paste a Script to Your Landing Page

In this step you need to do modify the landing page, so that all the data is automatically taken and used to build a click URL on a landing page. For this, copy the following script and paste it within the <head> section of your landing page. 

<head>
<script>
function getURLParameter(name) {
var query = window.location.search.substring(1);  
var vars = query.split("&");  
for (var i=0;i<vars.length;i++) {  
var pair = vars[i].split("=");  
if(pair[0] === name){return pair[1];}  
}  
return "";
}
</script>
</head>

In this script, the getURLParameter() is a function that looks for a given parameter name in the landing page URL and returns its value. Once this function with a parameter name used to pass a {trackingdomain} token is included in a click URL (what is described in the paragraph II of this guide), this click URL will use the fetched domain name once activated by a visitor.

Example:

Parameters in the URL are added as follows: http://lander_url.com?parameter_name1=value1&parameter_name2=value2&parameter_name3=value3

thus the getURLParameter(parameter_name2) returns the value2 and getURLParameter(parameter_name3) returns the value3

It means that when you have added the parameter with the {trackingdomain} token to the landing page URL: 

http://lander_url.com/?m1={model}&domain={trackingdomain}

the script will dynamically return exactly the same domain as for the campaign URL.

Having defined the function, you can now use it in your CTA links / buttons.

II. Modify the Click URL with the , Function

In a typical scenario, click URLs link to offer or offers. But if you want to have them dynamically built to include different domain names, you will have to modify them prior to pasting them on a landing page. Having two types of click URLs available in Voluum, jump to an appropriate section to learn how those links are modified.

  • <body> 
     .  
     . 
     .
    <script>document.write('<a href="http://'+ getURLParameter('domain') + '/click">Click here to win!</a>')</script> 
     . 
     . 
     .
    <body>
    http://your_domain.com/click

    Click URL:

    Take a look at the code sample below:

    In this case, the getURLParameter('domain') function retrieves a value that was passed in a {trackingdomain} token and the whole segment is substituted with this domain name, so the actual link will look like this:

    Paste this code sample on your landing page as described in the Adding Click URLs to a Lander article.

  • <body> 
     . 
     . 
    <script>document.write('<a href="http://'+ getURLParameter('domain') + '/click/1">Click here to win!</a>')</script>
     . 
     . 
    <script>document.write('<a href="http://'+ getURLParameter('domain') + '/click/2">Click here to win!</a>')</script>
     . 
     . 
    <script>document.write('<a href="http://'+ getURLParameter('domain') + '/click/3">Click here to win!</a>')</script> 
     . 
     . 
    </body>
    http://your_domain.com/click/1
    http://your_domain.com/click/2
    http://your_domain.com/click/3

    Multi-offer click URL

    Take a look at the code sample below:

    In this case, the getURLParameter('domain') function retrieves a value that was passed in a {trackingdomain} token and the whole segment in each link is substituted with this domain name, so actual links will look like this:

    Paste this code sample on your landing page as described in the Adding Click URLs to a Lander article.

Track & optimize
your campaigns with ease!