Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Journal tracking with Google Analytics

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
2 replies to this topic

#1 Arthur Lotuz   Members   

Posted 13 November 2012 - 11:34 AM

Is it somehow possible to include a small piece of javascript on the journal page / posts to track views with analytics? It would be useful to gather some data. Or a function to just add the tracking code, since actually submitting a pageview request to analytics is really simple.


[source lang="jscript"]<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', tracking_id]); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })();</script>[/source]

#2 Michael Tanczos   Staff Emeritus   

Posted 13 November 2012 - 01:31 PM

Hrmm.. we already do this for the site in general.. can multiple trackers co-exist on the same page?

#3 Arthur Lotuz   Members   

Posted 13 November 2012 - 03:03 PM

Yes, that's possible through asynchronous tracking code!

https://developers.g...ultipleCommands

[source lang="jscript"]_gaq.push( ['_setAccount', 'UA-XXXXX-X'], ['_setDomainName', 'example.com'], ['_setCustomVar', 1, 'Section', 'Life &amp; Style', 3], ['_trackPageview']);[/source]

On the second example you can see that you can even push views for multiple trackers on the same command.

[source lang="jscript"]_gaq.push( ['_setAccount', 'UA-XXXXX-1'], ['_trackPageview'], ['b._setAccount', 'UA-XXXXX-2'], ['b._trackPageview']);[/source]

I'm not sure if there's enough demand for this to be done, but it would be sweet for those interested on the data!

Edited by Arthur Souza, 13 November 2012 - 03:08 PM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.