how to set the variable for creating a clickTag in Javascript

4.8k Views Asked by At

how do I set up the variable in order to implement a clickTag in Javascript for an HTML5 banner ad? How do I get a reference to the URL that is set in which the banner clicks out to? I know how to do this in AS3. I'm new to programming & esp to Javascript. I am NOT using Swiffy nor am I using Flash & the <canvas>. I am using Google Web Designer with a generic environment.

inside my function I have

mainCTAClickOut= function (e) {

var clickTag = "?";  //here is where I'm having a problem

window.open(window.clickTag,  "_blank");

}

What am I missing?

4

There are 4 best solutions below

0
On

From my understanding, GWD automatically generates the variable script. GWD makes you do steps via their wizard function and all it asks for is the destination URL which can be altered at any time thereafter.

0
On

First on html5 banners there is no more clickTAG variable.

Html5 banner is some sort of Rich Media content which is a little bit different from the old-fashion flash banners.

Instead of clickTag, we have 'Exit' concept in Rich Media(Flash or html)

For html5 Rich Media here is the steps:

  1. You should add the exit button as a div tag with some id like:

    <div id="exit_button"> Click to Learn More </div>

  2. Then you should add the function to handle the exit and associate a name to it(This name will be used later on the DoubleClick Studio UI).

    function bgExitHandler(e) { Enabler.exit('Background Exit'); }

3.Bound the function to click event on the div tag

document.getElementById('exit_button').addEventListener('click', bgExitHandler, false);

But remember before the step one you should already added and initialized the 'Enabler':

<script src="https://s0.2mdn.net/ads/studio/Enabler.js"></script>

`// If true, start function. If false, listen for INIT.
window.onload = function() {
   if (Enabler.isInitialized()) {
        enablerInitHandler();
   } else {
        Enabler.addEventListener(studio.events.StudioEvent.INIT, enablerInitHandler);
   }
}

function enablerInitHandler() {
     // Start ad, initialize animation,
     // load in your image assets, call Enabler methods,
     // and/or include other Studio modules.
     // Also, you can start the Polite Load
}`

For a complete guide on how to create html5 banner, please refer to the following link.

https://support.google.com/richmedia/answer/2672545?hl=en&ref_topic=2672541&vid=1-635799307124943767-943471333&rd=1

0
On

FOR FLASH CC HTML5 CANVAS USERS

I remember the nightmare of a client breathing down my neck and trying to fin an answer to this question, An I swore when I did I would come on to a site like this and help other poor stressed out developer and animators to solve the problem. So here goes step by step.

In your html5 syntax, in the HEAD section paste the code below:

<script>
  var clickTAG = "www.yourURL.com";
</script>

replace the www.yourURL.com with your customers or whatever website you are targeting.

Move into the body section of your HTML and paste the following:

<a href="javascript: window.open(clickTAG, '_blank')">
   <img src="image.png"/>
</a>

To target the entire stage of your banner delete the img src="image.png" bit and just place the above code in front of the canvas id="canvas" and finally place /a after the id="canvas" section. and bobs your aunty. You have a working clickTag on your Flash HTML5 canvas.Sorry if the fact you cant use opening and closing tags in these posts makes it harder to understand.

Have Fun Martin!

0
On

Heloo Paulette,

I work for a spec database service (called OKNOK) and after studying some media kits, I can say that one way is to specify a global variable called clickTAG

<script>
  var clickTAG = "%%DEST_URL_ESC%%";
</script>

And use that where you want to execute the click:

<a href="javascript: window.open(clickTAG, '_blank')">
   <img src="image.png"/>
</a>