AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4K members online now
4K 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

Event tracking for google analytics

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hi, I am trying to set up an event which records when my PDF documents are being opened. I have included the below lines in my href and it doesn't work. Is there anything else I need to do?

 

<a href="Online Public Institution Tool Kit License.pdf" onClick="alert('here');_gaq.push(['_trackEvent','PDF', 'Download','PDF']);">Public Institution</a>

 

<a href="Online Private Institution Tool Kit License.pdf" onClick="ga(‘send’, ‘event’, ‘guides’, ‘Download’, ‘Online Private Institution Tool Kit License.pdf’, 10);">Private Institution</a>

 

Thanks!

 

 

1 Expert replyverified_user

Re: Event tracking for google analytics

Top Contributor
# 2
Top Contributor

Hi,

 

You don't need the first version of the code at all. It is for the outdated ga.js tracking.

 

Your second snippet has invalid single quote characters. Male sure you use the code exactly like below:

<a href="Online Private Institution Tool Kit License.pdf" onClick="ga('send', 'event', 'guides', 'Download', 'Online Private Institution Tool Kit License.pdf', 10);">Private Institution</a>

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: Event tracking for google analytics

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
hi, I made the changes you suggested yesterday but they are not reflected. I guess I am missing something. (1) Do I need to create a goal? (2) Once the event has been created, how long does it take for the code changes to be reflected? (3) If I click on the link to open my PDF document, should an event be created immediately and appear in Behavior, Events, Overview in GA? Or does it take a few hours or minutes to appear? Thanks, Amritha

Re: Event tracking for google analytics

Top Contributor
# 4
Top Contributor
Hi,

You don't need to create a goal to get the events registered. There is a delay but usually the events appear within an hour in the reports. If you can post your site URL I'd take a look at your setup.

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: Event tracking for google analytics

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
hi, The url is http://www.cbcsecosttoolkit.org. Thanks, Amritha

Re: Event tracking for google analytics

Top Contributor
# 6
Top Contributor
Hi Amritha,

Where are the links you set up event tracking for? Are they on members only pages? Please let me know.

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: Event tracking for google analytics

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭
No, not on a member only page. http://www.cbcsecosttoolkit.org/license2.html If you click on Private Institutions the event should fire. Thanks, Amritha

Re: Event tracking for google analytics

A T
Participant ✭ ✭ ✭
# 8
A T
Participant ✭ ✭ ✭

You can easily debug on the website with GA debugger:
https://chrome.google.com/webstore/detail/jnkmfdileelhofjcijamephohjechhna

 

I can see the event firing and data being sent to: UA-70024304-1