Event Tracking

Creating and modifying plugins.
Post Reply
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Event Tracking

Post 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
kleinerChemiker
Regular
Posts: 765
Joined: Tue Oct 17, 2006 2:36 pm
Location: Vienna/Austria
Contact:

Re: Event Tracking

Post by kleinerChemiker »

External links can be tracked with the Google Analytics Plugin.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Event Tracking

Post 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
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Event Tracking

Post 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
kleinerChemiker
Regular
Posts: 765
Joined: Tue Oct 17, 2006 2:36 pm
Location: Vienna/Austria
Contact:

Re: Event Tracking

Post by kleinerChemiker »

For that you have to manually add code to the links because Google do not disdinguish between links to the same site.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Event Tracking

Post 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
kleinerChemiker
Regular
Posts: 765
Joined: Tue Oct 17, 2006 2:36 pm
Location: Vienna/Austria
Contact:

Re: Event Tracking

Post 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.
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Event Tracking

Post 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
danst0
Regular
Posts: 197
Joined: Tue Jul 13, 2004 10:50 am

Re: Event Tracking

Post 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
Post Reply