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]
Journal tracking with Google Analytics
Started by Arthur Souza, Nov 13 2012 11:34 AM
2 replies to this topic
#1 GDNet+ - Reputation: 1154
Posted 13 November 2012 - 11:34 AM
A.
Lotus RPG Engine - My Journal: http://www.gamedev.n...die-rpg-engine/ |
Action RPG In development using XNA 4.0. | Blog in English: en.lotusrpg.com.br |
Personal blog In Portuguese: lotuzgames.wordpress.com |
Sponsor:
#3 GDNet+ - Reputation: 1154
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 & 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!
https://developers.g...ultipleCommands
[source lang="jscript"]_gaq.push( ['_setAccount', 'UA-XXXXX-X'], ['_setDomainName', 'example.com'], ['_setCustomVar', 1, 'Section', 'Life & 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.
A.
Lotus RPG Engine - My Journal: http://www.gamedev.n...die-rpg-engine/ |
Action RPG In development using XNA 4.0. | Blog in English: en.lotusrpg.com.br |
Personal blog In Portuguese: lotuzgames.wordpress.com |






