Analytics
5.5K members online now
5.5K 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
star_border
Reply

Where To Add the three separate codes for three emails and a Telephone number

[ Edited ]
Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

Hi,

 

Our Client want to add event tracking for three email address at their contact us page and one landline phone number.

note: I have changed the agency website name by @website.com.

 

John@website.com

David@website.com

Contact@website.com

+44(20)XXXX XXXX

 

I have gone through the help link https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide#intro and created the below codes:

<a href="http://www.website.com" onClick="_gaq.push(['trackEvent','Telephone Call','click','+44(0)20XXXXXXXX','0']);">+44(0)20XXXXXXXX</a>

<a href="http://www.website.com" onClick="_gaq.push(['trackEvent','email','click','John@website.com','0']);">John@website.com</a>

<a href="http://www.website.com" onClick="_gaq.push(['trackEvent','email','click','David@website.com','0']);">David@website.com</a>

<a href="http://www.website.com" onClick="_gaq.push(['trackEvent','email','click','contact@website.com','0']);">contact@website.com</a>

 

Now, My Question is where should I place these codes. We have already added Google Analytic Code to the website and its tracking.

 

1. Should I place the code in between the currect Analytic Code ?

 

or

 

2. Should I replace the code at contact us page where all these four links are present?

 

I am from Adwords department and our web developer is on leave and I am given the responsibility to add the event tracking.

 

- Syed Nouman

Re: Where To Add the three separate codes for three emails and a Telephone number

Explorer ✭ ✭ ☆
# 2
Explorer ✭ ✭ ☆
You need to keep your existing GA page code on the pages and add these event tracking code within <a> </a> of these links.

You're using the old GA event tracking code, so if you're using universal analytics (analytics.js) - you need to change these event tracking code to the one in the below link .
https://developers.google.com/analytics/devguides/collection/analyticsjs/events#outbound_link_and_fo...

Re: Where To Add the three separate codes for three emails and a Telephone number

Follower ✭ ✭ ☆
# 3
Follower ✭ ✭ ☆
Thanks Syed,

But where should I place the codes?

The below code is found from page source:
--------
&lt;script&gt;
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-76014507-1', 'auto');
ga('send', 'pageview');

&lt;/script&gt;

---------------------

Please suggest as we need to add events so that the client adds Goals.
- Syed Nouman

Re: Where To Add the three separate codes for three emails and a Telephone number

Explorer ✭ ✭ ☆
# 4
Explorer ✭ ✭ ☆
You need to change your event tracking syntax to universal analytics event syntax in the link above. Then you need to add this code in the links for these emails and contact links. For example for the emails - <a href="mailto:someone@example.com onClick="_ga(['send','event','email','click','John@website.com']);"">Send Mail</a>
</p>

In order to do this you need to have access to the page source code and able to edit the source code.