Difference between revisions of "Integrating ConversionRuler with Flash"
From Market Ruler Help
Line 4: | Line 4: | ||
'''ActionScript 3.0:''' | '''ActionScript 3.0:''' | ||
+ | |||
import flash.external.*; | import flash.external.*; | ||
function cr_track(action):void | function cr_track(action):void | ||
{ | { | ||
− | ExternalInterface.call(" | + | ExternalInterface.call("__CR.track("+action+")"); |
} | } | ||
Line 14: | Line 15: | ||
'''ActionScript 2.0:''' | '''ActionScript 2.0:''' | ||
+ | |||
function cr_track(action) | function cr_track(action) | ||
{ | { | ||
import flash.external.*; | import flash.external.*; | ||
− | ExternalInterface.call(" | + | ExternalInterface.call("__CR.track("+action+")"); |
} | } | ||
− | trackable.onPress = function () { | + | trackable.onPress = function () { __CR.track(1) }; |
Where "trackable" is our button instance name. | Where "trackable" is our button instance name. | ||
− | Note as well that the ''' | + | Note as well that the '''__CR.track''' function defined above (in ActionScript) simply calls '''[[__CR.track]]''' (in JavaScript) defined on your web page. |
* [http://static.marketruler.com/sites/wiki/flash/Flash-ConversionRuler-Example.html View example without debugging] | * [http://static.marketruler.com/sites/wiki/flash/Flash-ConversionRuler-Example.html View example without debugging] |
Latest revision as of 15:24, 26 February 2016
Integrating ConversionRuler with Adobe Flash is straightforward; you simply invoke the tracking snippet on the page in ActionScript in your Flash Movie.
A simple example of this would be:
ActionScript 3.0:
import flash.external.*; function cr_track(action):void { ExternalInterface.call("__CR.track("+action+")"); } trackable.addEventListener("click", function () { cr_track(1); });
ActionScript 2.0:
function cr_track(action) { import flash.external.*; ExternalInterface.call("__CR.track("+action+")"); } trackable.onPress = function () { __CR.track(1) };
Where "trackable" is our button instance name.
Note as well that the __CR.track function defined above (in ActionScript) simply calls __CR.track (in JavaScript) defined on your web page.
- View example without debugging
- View example with debugging (the tracking will be shown as alert boxes)
- Download Flash Source