Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Journal tracking with Google Analytics


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 Souza   Members   -  Reputation: 1419

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]

A.

Lotus - Action RPG In development http://www.gamedev.n...die-rpg-engine/ |
Personal blog In Portuguese: lotuzgames.wordpress.com |


Sponsor:

#2 Michael Tanczos   Senior Staff   -  Reputation: 5437

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 Souza   Members   -  Reputation: 1419

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.

A.

Lotus - Action RPG In development http://www.gamedev.n...die-rpg-engine/ |
Personal blog In Portuguese: lotuzgames.wordpress.com |





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.



PARTNERS