1.8K 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 help

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Do you have to set up tag in order to set an event? I cannot get an event to track and I'm not sure if it is my code or that I dont have a tag set.

 

I have tried: ga('send', 'event', 'Videos', 'play', 'Fall Campaign');

And: _gaq.push([ '_trackEvent', 'Category', 'Action', 'Label is Optional']);

 

with no success. Any suggestions would be great!

Thanks,
Kathy

1 Expert replyverified_user

Re: Event Tracking help

Top Contributor
# 2
Top Contributor

Hi Kathy,

 

You need to load the Google Analytics library in order to send hits to Google Analytics.

 

<script>
  (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','https://www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-XXXXXXX-1', 'auto');

</script>

Once you put the above code in your head tag on your page you will be able to send events to GA using the code ga('send', 'event', 'Videos', 'play', 'Fall Campaign');

 

Let me know if you have more questions.


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 help

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Thank you. I added this code and will see if it starts to track!

Thanks so much