3K members online now
3K members online now
Learn how to set up goals and Ecommerce tracking, verify accuracy of attribution traffic sources, and discuss funnel visualization, Multi-Channel Funnels, the Goal Flow Report, and Enhanced Ecommerce
Guide Me

Tracking Wordpress Button Clicks

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm having trouble tracking button clicks as events on Wordpress.


Originally, I tried to insert the GA tracking code into the shortcode for the button. I realized that was not possible.


So now, I have re-inserted the button using CSS and HTML rather than the shortcode. I then added the GA tracking code, but I still am not able to track the button clicks.


I have tested the GA tracking code on a simple text link and it tracks fine, so I know all of the parameters within GA are set correctly. I know it must have something to do with the configuration of the button.


Here's a link to the page:


There are 3 green "Buy Now" buttons on the page with the first being half-way down the page on the right side. I've set all 3 buttons up the same. Here's the code I've used:


<span class="cb-button cb-green cb-big cb-left"><a href=";sponsor=4e0db09c-6322-4c59-881e-8a1cf6b08158&#038;culture=en-US&#038;catId=ProductSystemPakBase30Dayprogram" target="_self" rel="follow" onClick="ga('send', 'event', 'Buy Now', 'Clicked', 'Isagenix 30 Day System');">BUY NOW</a></span>

Any advice would be appreciated!

1 Expert replyverified_user

Re: Tracking Wordpress Button Clicks

Top Contributor
# 2
Top Contributor
Hi Sean,

Your event code is fine.
You put the tracking code twice on the site. This leads to broken results for bounce rate, time on page, number of pageviews, etc. and it might affect recording your events. Please remove one of the instances of the tracking code and check if the events are recorded. Hope this helps.

Arnold Majlath, Google Analytics Top Contributor
Was my response helpful? If yes, please accept it as solution.
Circle Me On Google+ | Visit me @ Redfly Digital

Re: Tracking Wordpress Button Clicks

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thanks, Arnold, but that was a carry-over mistake from me messing around this morning and trying to fix the issue.
The theme came with a custom code section for the header where I had originally placed the tracking code. I thought maybe there was a problem so I moved the tracking code to the core header file. I thought I deleted the code, but must not have saved it. I've since gone back and removed the second tracking code. So at any rate, that didn't solve the issue.
Any other ideas? Thanks for your input.
Marked as Best Answer.
Accepted by topic author Sean M
January 2016

Re: Tracking Wordpress Button Clicks

Visitor ✭ ✭ ✭
# 4
Visitor ✭ ✭ ✭
I resolved the issue. The link was set to "_self" and not "_blank", so I don't think a pageview was registering. Is there any way to make it work without having to open a new window? Thanks