javascriptclicktag

Digital ad Clickthrough function instead of simple variable and how to properly implement


I've been using the following for inserting urls for digital ads

var clickTag = "http://www.example.com";
<a href="javascript:window.open(window.clickTag)">

The company I work for sets up tracking URLs that we have been manually putting into ads and sending to media partners. It was recently requested by some of them that I instead use this function in their guidelines instead, which is based on the latest iab guidelines:

function getParameterByName(name) {
var match = RegExp('[?&]' + name +
'=([^&]*)').exec(window.location.search);
return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
}
var clickTag = getParameterByName('clickTag');

<a href="javascript:window.open(clickTag, ‘_blank’);">

I guess what I need help understanding is where the URL goes in this version that I was previously adding as the var clickTag in the first version?


Solution

  • Just got word from a media partner that we aren't supposed to be adding the links ourselves and instead using the script based on the iab guidelines and they add the link as part of the upload process. Problem solved.