AS3: Calling Google's Urchin Tracker from Flash


/ Published in: ActionScript 3
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.