How do I add event tracking to these buttons?
-
I have two separate events that I would like to track on my site.
[Ask a Question](javascript:__doPostBack('ctl00$MainContent$AskQuestionButton',''))
and
I think I would want to use this-_gaq.push ([‘_trackEvent’,’event category’,’event action’,’event label’, event value]); Is that correct? Where would I place it in the button code?
Would this work?
_gaq.push ([‘_trackEvent’,’AskAQuestion’,’Submitted’,’event label’, event value]);The event doesn't have a label or value. Are those left blank?
-
Yes - that's right.
What you should do is implement it - then click on the link and at the same time check your real time analytics report in GA. They've added a new tab that allows you to see your events in real time. So you should see the event being logged as an active visitor on the site.
-
Do I need the quotes around the gaq push all the way to the end? I am seeing some mixed results when I search for that.
onclick="_gaq.push ([‘_trackEvent’,’AskaQuestion’,’Submitted’]); ">
-
Sorry Niners52
I'm just saying to use the apostrophe key on your keyboard to type the apostrophes. Otherwise you might get an odd character like the second apostrophe which looks like a proper apostrophe - but isn't - and that will throw up an error.
Hope that makes sense.
-
My apostrophes look like the second one how do I get them to look like the first?
-
Be careful if you're copying and pasting from here into your code - and ensure that the apostrophe's look like this (') instead of this (‘).
-
I'll try this. Thank You very much!
-
Hi
You need to add an onclick event...
[Ask a Question](javascript:__doPostBack('ctl00$MainContent$AskQuestionButton',''))
and
but replace 'event action', 'event label' and 'event value' with values you can understand like 'top quote button', 'homepage' etc.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Event/Goal Tracking For EKM Powershop
Hi There, I have a client with EKM powershop. I am trying to figure out a way to either setup goal tracking (however I don't know what the final destination page is) or event tracking. I know I can do the ecommerce tag thing, but I am always worried about breaking the tracking code. Any ideas?
Reporting & Analytics | | nezona0 -
How to track in google analytic which filters selected in which category?
Hi All, Can anyone tell me how to track which filters selected in which category like in category I have 1) price ( then different - different price) 2) color ( then difference - difference colors) same for size, width, brand etc. Is it possible to track in detail via tag manager? Other than tag manager what are the best way to track filters? Please explain me technical guidance too. Thanks!
Reporting & Analytics | | adamjack0 -
Universal Analytics Tracking code for Measuring Addition/Removal from Cart via GTM
Hello Experts, Can you please tell me Universal Analytics Tracking code for Measuring Addition/Removal from Cart via GTM? Any one tell me process and code? Thanks!
Reporting & Analytics | | bkmitesh0 -
Custom URL tracking for paid online ads
Hello! Our marketing team is testing paid online ad networks (banner ads, mobile ads and video ads) this year in addition to some traditional television advertising. We would like to track how effective these various ads are, and I'm wondering the best method to do so. In all cases, we're not setting up new pages for these ads to go to. They will simply go to an existing page on our site. For tracking purposes, here's what I'm wondering... If we set up custom URLs on our site (e.g. www.example.com/sports) then have the visitor immediately redirected to the intended page on our site (typically our home page), will Google Analytics show that custom URL in any report to see how much traffic flowed through it? Or will it not register because a page doesn't really exist for that URL? The biggest issue is with the banner ad network, which targets around ten categories of sites (sports, moms, entertainment, etc.). I know I'll be able to find the network listed as a referrer to see the total traffic the network sent us, but we would like to know specifically which category drove the visits. As such, would a custom URL for each category work, or will Google Analytics not pick it up because it's not hitting an actual page? For television ads, we are showing our URL as www.example.com/tv, which would then redirect to the intended landing page. In this case, it's a little more challenging because I won't have the referrer traffic to go by. But same problem... will GA recognize that URL and show it in Behavior > Site Content > All Pages? I hope this makes sense. If not please let me know and I'll try to explain. Thanks in advance,
Reporting & Analytics | | SmileMoreSEO
Erik0 -
How do i get Social Media Actions Tracked in GA
Greetings from 17 degrees C wetherby UK 🙂 http://i216.photobucket.com/albums/cc53/zymurgy_bucket/how-do-get-this.jpg The above url pints to dat I'd love to see in my Google analytics account but instead all i can see is this:
Reporting & Analytics | | Nightwing
http://i216.photobucket.com/albums/cc53/zymurgy_bucket/no-socail-media-engagementcopy.jpg What i really want to measure is Facebook Likes etc not just referral traffic from social media sites. So my question is please... "Do i have to add additional tracking code to Google analytics as explained here - https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial " Thanks in advance,
David0 -
Conversion tracking
Is there a way in GA to setup tracking of the clicking internal URL that 301's to an affiliate ID? Peter
Reporting & Analytics | | PeterM220 -
Tracking Email campaign
I generated the following URL to track visits from newsletter. http://www.example.com/ ?utm_source=newsletter1&utm_medium=email&utm_campaign=newletter2109 Do i have to use this link in our email ? My question is it looks ugly. How do i shorten this ? Using bit.ly ? But isn't it true that URL shortening services such as bitly, as some can increase the likelihood of email being marked as spam
Reporting & Analytics | | seoug_20051 -
Google Analtyics Cross Domain Tracking - in a form
I have a 3rd party booking engine that is causing my own domain to show up as a top referreral in google analytics. The vendor is on my very last nerve 🙂 So they're not helping. Would anyone be interested in helping a newbie out with a frustrating problem? Code: Reservations Page - function SubmitReservationForm() {. . . .
Reporting & Analytics | | jenny05
ResLink = "http://www.bookingengine.com/res/vn4/checka.aspx?month=" + Month + "&day=" + Day + "&year=" + Year + "&nights=" + Nights + "&rooms=" + Rooms + "&adults=" + Adults + "&children=" + Children + "&B1=Check+Availability&hotelid=xxxx"
pageTracker._link(ResLink);
return true;
} On Every page: Any thoughts would be appreciated! I believe the problem is pageTracker._link(ResLink); but I'm clueless on fixing it.1