Page 1 of 1

Event Tracking

Posted: Wed Dec 15, 2010 8:26 am
by danst0
Hi,

in the popular entries plugin I would like to add google event tracking and I was wondering what would be the best way to do it?

Basically I have to add something like this:

Code: Select all

onClick="_gaq.push(['_trackEvent', 'Videos', 'Play', 'Baby\'s First Birthday']);
to each link entry.

How are external links tracked (google analytics plugin)? I cannot find any clue in the sources of my blog on a similar entry for those.

Daniel

Re: Event Tracking

Posted: Wed Dec 15, 2010 9:07 am
by kleinerChemiker
External links can be tracked with the Google Analytics Plugin.

Re: Event Tracking

Posted: Wed Dec 15, 2010 9:44 pm
by danst0
And how would I track internal links? So eg. track clicks on the popular links sidebar plugin or the static page plugin?

Daniel

Re: Event Tracking

Posted: Thu Dec 16, 2010 8:01 pm
by kleinerChemiker
Also with the GA Plugin.

Re: Event Tracking

Posted: Thu Dec 16, 2010 8:33 pm
by danst0
Ok, on my start page there are multiple links to the same site. How can I differentiate where the user clicked? How would I do that with the GA plugin?

Daniel

Re: Event Tracking

Posted: Thu Dec 16, 2010 8:54 pm
by kleinerChemiker
For that you have to manually add code to the links because Google do not disdinguish between links to the same site.

Re: Event Tracking

Posted: Fri Dec 17, 2010 6:32 am
by danst0
What would you suggest to be the best approach here? Should I change the code of the corresponding plugin or is there a way to do it in a more general way for all sidebar plugins?

Daniel

Re: Event Tracking

Posted: Fri Dec 17, 2010 7:29 am
by kleinerChemiker
If you need it for the whole blog, then i would change the plugin. You could f.e. add the article id to the link you send to ga.

Re: Event Tracking

Posted: Fri Dec 17, 2010 7:44 am
by danst0
What is the best practice in plugin development then? Due to the automatic update function it would probably be good to make a copy of the old plugin, rename it and then develop there?

Daniel

Re: Event Tracking

Posted: Mon Dec 20, 2010 1:49 pm
by danst0
Hi,

In my endeavors to get more insights from my visitors behavior I just realized, that external links in the of the sidebar content are only tracked if in the html nuggets. Eg. the amazon recommendation plugin is not tracked.

I've had a look at the code and the links just seem to be enhanced there with the onclick event. But how could I include the other content of the sidebar there as well?

Daniel