Posted By

davidfrechette on 01/27/10


Tagged

google flash application as3 Analytics facebook


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

abbey


Tracking with Google Analytics in facebook from flash app


 / Published in: ActionScript 3
 

URL: http://forum.developers.facebook.com/viewtopic.php?id=14243

  1. Place this on the page:
  2. <fb:iframe name="_tracker" width="0" src="<your url>" style="visibility:hidden;display:none; width: 0px; height: 0px" frameborder=0/>
  3.  
  4. Add a proxy for Google, mine is in jsp:
  5. <%@ page import="java.io.*"%><%@ page import="java.net.*"%>
  6. <%
  7. String strID = request.getParameter( "trackID" );
  8. %>
  9.  
  10. <head><title>Trackerk</title>
  11. <script type="text/javascript">
  12. var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
  13. document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
  14. </script>
  15. <script type="text/javascript">
  16. var pageTracker = _gat._getTracker("<your google id>");
  17. function trackClick(location)
  18. {
  19. pageTracker._trackPageview(location);
  20. //alert( location );
  21. }
  22. trackClick("<%=strID%>");
  23. </script>
  24. </head>
  25.  
  26. Now in flash:
  27. var request:URLRequest = new URLRequest( GetGoogleURL( ) + "&trackID=" + i_ID );
  28. request.method = URLRequestMethod.GET;
  29. navigateToURL( request, "_tracker" );

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: markval on February 15, 2010

Hey David,

http://wiki.developers.facebook.com/index.php/Fb:google-analytics with http://wiki.developers.facebook.com/index.php/Fb:fbjs-bridge

You can use this to track with google analytic without the hack above and without using the buggus iframe and URLrequest that can cancel eatch other.

Cheers

You need to login to post a comment.