Tracking with Google Analytics in facebook from flash app


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



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

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.