Pubblegum with Adobe ActionScript 3

Installing the Component

To auto-install the Pubblegum Component just download the file from the download page, unzip it and double click it. Macromedia Extension Manager or Adobe Extension Manager takes care of the rest. If you do not have the manager, it is freely available at the Adobe Website.
Make sure to restart Flash after installation.

Using the Component

After a successful installation the component will be available in the Components tab inside Flash. To open the Components window, select Window > Components from the Window menu.

Components tab.

Two different elements can be tracked: by activating the component, each impression (ie. appearance of the swf file on a website) will be logged. By using the click function, a normal clickTAG can be replaced by a logged click. The original clickTAG is automatically tracked, and will be conform adserver requirements.

Attention Minimum required publish settings: Flash player 8.

Activating the Component

  1. Create your file.
  2. Drag an instance of Adhese Pubblegum on a new layer.
  3. Name the instance ‘pubblegum’
  4. Select the ‘Parameters’ of the instance and enter the 3 required parameters:
    • companyID: this is your adhese ID
    • campaignID: a name for your campaign (letters only - no special characters)
    • creativeID: a name for the banner you want to track (letters only - no special characters)

Properties tab.

Component inspector.

This is the basic Pubblegum setup. Your ad will now be tracked. To test it, select ‘Test Movie’ from the Menu. In the output screen an url will appear (containing "agency.adhese.com").

Tracking clicks

To track clicks you will have to replace a line of code in the normal clickTAG script you use. Normally you would write something like this to ad a clickTAG to your movie:

myButton.buttonMode = true;
myButton.addEventListener(MouseEvent.CLICK, doClick);
function doClick(e:MouseEvent):void{
    navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG));
}

To track a click with Pubblegum, you should edit the code as follows:

myButton.buttonMode = true;
myButton.addEventListener(MouseEvent.CLICK, doClick);
function doClick(e:MouseEvent):void{
	pubblegum.clickR(root.loaderInfo.parameters.clickTAG);
}

To track a click with Pubblegum, and still keep the original clickTAG you should edit your code as follows:

myButton.buttonMode = true;
myButton.addEventListener(MouseEvent.CLICK, doClick);
function doClick(e:MouseEvent):void{
	pubblegum.click();
	navigateToURL(new URLRequest(root.loaderInfo.parameters.clickTAG));
}

Tracking custom actions

To track actions, you only need this line of code:

pubblegum.action("your_action_name");

Please, do not use characters like @#$%

When publishing your swf and clicking on it you should see something like this:

- Pubblegum for AS3 by Adhese -
http://creative.campaign.adhese.agency.adhese.com/log/adhese/campaign/creative/file:///HD/Users/...

Generating an Embed Code for your Flash movie

Your object tag should contain a classid and an id:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width='728' 
height='90' id='banner'>

The embed tag should contain a name attribute:

<embed src='banner.swf' name='banner' 
allowscriptaccess='always' width='728' height='90'>

If these parameters are missing tracking will not work properly!

Note: when you test the clickTAG in ‘Test Movie’, you will receive an error. This is because the actual clickTAG value is not defined in the Test environment of Flash

Events

PubblegumEvent.READY

This event is triggered when Pubblegum is fully initialized.

pubblegum.addEventListener(PubblegumEvent.READY, ready);
private function ready(e:PubblegumEvent):void{
	trace("Pubblegum is at your service");
}

PubblegumEvent.LOGGED

This event is triggered each time Pubblegum performs a log action. The data object contains the logged type.

pubblegum.addEventListener(PubblegumEvent.LOGGED, logged);
private function logged(e:PubblegumEvent):void{
	trace(e.type);
}

PubblegumEvent.URL_FOUND

This event is triggered when Pubblegum has found the swfs location. The data object contains the found url. This url can be used for site specific targetting.

pubble.addEventListener(PubblegumEvent.URL_FOUND, urlFound);
public function urlFound(e:PubblegumEvent):void{
	trace("found url: " + e.data);
}