Analytics
2.9K members online now
2.9K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Hi, would anyone be of help if I have this onclick code setup properly

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Thanking you in advance

 

Have set is up but have no idea if it is correct, I have the Category setup as PhoneCall, Action as Click and Label as StylistPage. Not sure about if this part is right or wrong _gaq.push.

 

<code><a href="tel:0400000000" onclick="_gaq.push(['_trackEvent', 'PhoneCall', 'Click', StylistPage']);"> <strong>0400000000</strong</code>

 

My two cents some really example would have been great, have read so much and watch so many videos I am starting to go cross-eyed. I was taught KISS, keep simply stupid.

 

Kindest Regards

 

 

1 Expert replyverified_user

Re: Hi, would anyone be of help if I have this onclick code setup properly

Google Employee
# 2
Google Employee
Hey John,

The code you're referring to is the old code. You should have updated to universal analytics since and should be using this format:
onclick="ga('send', 'event', 'PhoneCall', 'Click', StylistPage');

This example is the one I'd recommend: https://developers.google.com/analytics/devguides/collection/analyticsjs/events#examples

To know more about switching to universal analytics, read this: https://developers.google.com/analytics/devguides/collection/upgrade/

Re: Hi, would anyone be of help if I have this onclick code setup properly

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hi Arjun R,

Thank you for that, just one final question if I may have taken your advice and changed the code is this now correct.

<code><a href="tel:0400000000" onclick="ga('send', {hitType: 'event', eventCategory: 'PhoneCall', eventAction: 'Click', eventLabel: 'StylistPage' });"> <strong>0400000000</strong</code>


Thanking you.
John

Re: Hi, would anyone be of help if I have this onclick code setup properly

Google Employee
# 4
Google Employee
Hey John,

We tend to use your format of calling out hitType, eC, eA and eL, only when calling the send event command in a function. Here with onClick, I've seen that it works without that as well, so you can simply use onclick=ga('send', 'event', 'PhoneCall', 'Click', StylistPage');