Google Analytics Event Tracking


#1

Hello there,

I am really happy with the theme and even more with the support here.

I have one more question, guess it’s the last one :):

I would like to use Google Analytics Event tracking and installed the ‘WP Google Analytics Events’ Plugin but I dont get it working. I tried to track a click on a call-to-action button. Is that possible and which code or plugin should I use?

Thanks a lot!


#2

Hey,

The call to action button is just a simple link so I’m not sure why it wouldn’t work. An the other hand I don’t know how that plugin works and we don’t handle plugin support:)
I belive last time I used a plugin like this it was from Yoast, though I don’t remember exactly.


#3

Hey,

thanks for the answer :). Tried again but somehow it’s not tracking any events.
Will try with a Yoast tool, thanks ;).


#4

Hey,

I managed to track when someone hits a button which I defined like that:
<form action="#facts" onclick="_gaq.push([’_trackEvent’, ‘test2’, ‘asdasd’, ‘asdawdawd’]);" style=“margin: 0; text-align: center;” >
<input type=“submit” value=“Go to Facts”>
</form>

I used a text widget and not the call to action widget since I didnt have access on its html to insert the google event tracking code. Is there a easy way to get access, otherwise no problem :)!?
I inserted the code in a Text Widget instead and it works perfectly.
Now my only problem is that there is no smooth scroll but a rough, not nice jump to reach the link ‘#facts’.
How can I tell the link to scroll down smoothly like is does with the welcome header button?

Thanks a lot! Your theme rocks.


#5

Smooth scrolling is supposed to only work with links, not forms. It’s easy to insert your code in the call to action widget, but it’s harder to do it in a update-proof way. You would require a child theme.

I had a look and I’m using Google Analytics by Yoast on a site. It doesn’t require any manual code adding. Though I think all these plugins track only outbound links.


#6

Hey Vlad. Thank you! Awesome support!

Yes these plugins all have some disadvantages and I only want to do this tracking for one button on a specific page.

I googled a bit more and found a solution. If someone is interested:

<div class="buttons" align="center" >
  <a href="#facts"  onclick="_gaq.push(['_trackEvent', 'test4', 'asdasd', 'asdawdawd']);"><button class="action bluebtn"  ><span class="label" >Scroll to facts</span></button></a>
</div>

Probably not the nicest coding but it works :).