PDA

View Full Version : Click Tag on Ad



anmartinez
20 Aug 2012, 12:11 PM
How do you apply a click tag on an ad for tracking purposes? I know in Flash you would typically create a blank button but how would you go about it in Animator.. Thanks for the help

miro.bojic
21 Aug 2012, 6:25 AM
Hi,

You can set up clickTag functionality in quite a similar way to how you would do it in Flash.

First create a new rectangle object, and put it on top of all other objects in your project. Set the properties as follows:

Border: turn it off.
Width, height: match project width and height.
Position: 0, 0
Opacity: 0%

Next, select the basestate of the object and under Actions->Click->Custom Javascript, you need to add script for clickTag functionality. There are probably many ways to do this, but this should work for basic cases:



//find if clickTag is set. First, we need to parse parameters that are passed and see if clickTag is set
var parameters = window.location.search; //all parameters that are passed
var clickTagIndex = parameters.indexOf('clickTag=');

//only if there is clickTag defined, we do the following
if(clickTagIndex > 0) {
clickTagIndex += 9;
var clickTag = parameters.substr(clickTagIndex); //extract the value behind clickTag


//if there are multiple parameters other than clickTag, get the string only up to '&'
if (clickTag.indexOf('&') > 0) {
clickTag = clickTag.substr(0, clickTag.indexOf('&'));
}
//if clickTag is an actual link, open it in a new page
if(clickTag.substr(0,5) === 'http:') {
window.open(clickTag, '_blank');
}
}


In Flash, when you embed an ad and set a clickTag, you typically want to do something like this:


<embed src="flash.swf?clickTag=http://www.someurl.com">

Animator projects are usually embedded in iFrames. First, export your project for embedding (File->Other Export->Export for Embedding. Then you can embed your ad with clickTag into your page as follows:


<iframe src="ad.html?clickTag=http://www.someurl.com">