Posted By

chrisaiv on 02/03/08


Tagged

as3


Versions (?)

Who likes this?

7 people have marked this snippet as a favorite

blackabee
visuallyspun
sparker
THEPWN3R
enajenkins
muoto
tspitzr


AS3: Calling Google's Urchin Tracker from Flash


 / Published in: ActionScript 3
 

Needed to figure out how to call Google's Urchin Tracker in AS3 since getURL is no longer available. This example uses External Interface

  1. //ExternalInterface Send Method
  2. ExternalInterface.call("urchinTracker",trackingStr);
  3.  
  4. //Strip Out Spaces and Replace with Underscores
  5. var pattern:RegExp = / /gi;
  6.  
  7. //Formulate Tracking String
  8. var formattedVideoTitle:String = _videoTitle.replace(pattern, "_");
  9.  
  10.  
  11. var trackingStr:String = "/" + _trackingPath + "/" + formattedVideoTitle;
  12.  
  13. //URL Request Send Method
  14. sendToURL(new URLRequest("javascript:urchinTracker('"+trackingStr+"');");

Report this snippet  

You need to login to post a comment.