Created
April 22, 2014 18:05
-
-
Save astein/11188749 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private var _oneInteraction:Boolean; | |
private var _thirtySeconds:Boolean; | |
private var _creativeCompletion:Boolean; | |
public function startEngagement():void | |
{ | |
stage.addEventListener(MouseEvent.CLICK, onOneClick); | |
setTimeout(onThirtySeconds, 30000); | |
} | |
public function onOneClick(e:Event):void | |
{ | |
if (_oneInteraction || _creativeCompletion) return; | |
_oneInteraction = true; | |
if (_thirtySeconds) | |
trackInteraction('TRUE_ATTENTION'); | |
} | |
public function onThirtySeconds(e:Event):void | |
{ | |
if (_thirtySeconds || _creativeCompletion) return; | |
_thirtySeconds = true; | |
if (_oneInteraction) | |
trackInteraction('TRUE_ATTENTION'); | |
} | |
public function onLastFrame():void | |
{ | |
if (_thirtySeconds || _creativeCompletion) return; | |
_creativeCompletion = true; | |
trackInteraction('CREATIVE_COMPLETION'); | |
} | |
public function trackInteraction(value:String):void | |
{ | |
var tagLoader:Loader = new Loader(); | |
tagLoader.load(new URLRequest('//serve.truex.com/c.gif?label=GDN_1_' + value)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment