Home > Technical & Creative Skills > Programming, Servers & Scripts

Testing URL parameters (tokens) (7)


01-28-2017 11:15 AM #1 jelz03 (Member)
Testing URL parameters (tokens)

Hey guys!

What's the quickest way to test your token personalization scripts?

My CTR of ripped landers was really low and I noticed my url tokens didn't work properly, that left blanks in my text and sentences were weird without the name of the device appearing on my landers.

How do you test that quickly?


01-28-2017 11:50 AM #2 twinaxe (Senior Moderator)

Just check if the parameters from the scripts on the lander appear in your URL too.
If they don't change them accordingly.


01-28-2017 06:48 PM #3 jelz03 (Member)

Right now I need to upload the landers on my CDN set it up in Voluum and then check my links.

I thought there might be a quicker way.


01-28-2017 10:20 PM #4 platinum (Veteran Member)

Let's say that the lander is pretty basic with as in the below example.

Code:
<html>

<head>
<meta name="viewport" content="user-scalable=no, initial-scale=1.0, maximum-scale=1.0, width=device-width">
<title>Token Test</title>

<script>
function getURLParameter(name) {
    return decodeURI(
        (RegExp(name + '=' + '(.+?)(&|$)').exec(location.search)||[,null])[1] || ''
    );
}
</script>
</head>
<body>
<h3>
Hello <script>document.write(getURLParameter('model'))</script> user, you just won!<br><br>
Hello <script>document.write(getURLParameter('brand'))</script> user, you just won!<br><br>
Hello <script>document.write(getURLParameter('os'))</script> user, you just won!<br><br>
Hello <script>document.write(getURLParameter('isp'))</script> user, you just won!<br><br>
</h3>
</body>

</html>
You just open the HTML file in a browser like Chrome and test tokens by adding their values manually. Just make sure the parameters names in the html document match those on the address bar.
Click image for larger version. 

Name:	tokens.PNG 
Views:	26 
Size:	25.7 KB 
ID:	14232

Once you've checked the scripts according to Voluum's guide on How to display a Voluum parameter on lander you continue with setting up the tokens on the page like you did localy on your PC but this time instead of fixed parameters you replace them with the available tokens.
Click image for larger version. 

Name:	tokens1.PNG 
Views:	22 
Size:	8.9 KB 
ID:	14233


01-29-2017 01:27 PM #5 jelz03 (Member)

Thanks a lot platinum!

I thought Voluum was mandatory to be able to check that. I didn't know how to add them manually in my browser.

Thanks for the screen captures as well, I encountered problems because I didn't add the "&" between tokens on Voluum.


01-29-2017 02:00 PM #6 platinum (Veteran Member)

You're welcomed

Everything is in the forum and in a very short time you'll realize how well structured the information is.


02-06-2017 05:31 PM #7 chris_climbs (Member)

I like to add default parameters as well, to be thorough. You can do this by setting variables under your `getURLParameter()` function declaration like so:

var model = (modelParam = getURLParameter('model')) ? modelParam : 'phone';
var brand = (brandParam = getURLParameter('brand')) ? brandParam : '';
Then, in your html you can reference `model` or `brand` and something will always be injected rather than blanks or `undefined` if a param was missing.

If you get an error, you might need to try a different version of `getURLParameter`.


Home > Technical & Creative Skills > Programming, Servers & Scripts