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
-
Cross domain tracking Google Analytics
Hi there, Got a question on cross domain tracking: We have a couple of TLD's to serve localized content to our visitors, next to our main .com TLD where our app is running as well in a subdomain. Situation is this: Local sites:
Reporting & Analytics | | jorisbrabants
marketingsite.be
marketingsite.com.br
marketingsite.fr Main site: marketingsite.com
app.marketingsite.com Conversion gets triggered when somebody ends up in app.marketingsite.com/firstuse for example. People can sign up at the local site filling in their email but they end up in app.marketingsite.com/firstuse Reading this article on cross domain tracking I'm getting a bit confused on the setup of the tracking code itself. The sample code provided shows these two lines: ga('require', 'linker'); ga('linker:autoLink', ['maindomain.com','targetdomain.com']); Now the question 🙂 Is it correct when I think that maindomain should be replaced with our local TLD's on every one of those, and that targetdomain is where the conversion happens? In this case the .com site?0 -
I am tracking my domain e.g www.xyz.com to an existing google analytics account . I want to track www.xyz.com/blog separately in the google analytics account. How can I do that?
I am tracking my domain e.g www.xyz.com to an existing google analytics account . I want to track www.xyz.com/blog separately in the google analytics account. How can I do that?
Reporting & Analytics | | Windlass0 -
How is this site being tracked in GA?
Hi, Bit of an unusual one this, so please bear with me. This site http://www.hayesandhurst.com/ is being tracked in Google Analytics but we're unsure as to how. To the best of our knowledge we haven't inserted the tracking ID into the theme options or the tracking code into the source - and yet it appears to be tracking successfully! I did send some instructions to the client to set up the Analytics account in their name - I fear they have added the code somewhere to the site, but we cannot see where! Perhaps via Google tag Manager?? As I say, an odd one this, but if anyone can shed any light on this mystery i'd be hugely grateful. The tracking ID is UA-64505394-1 for the record. Regards,
Reporting & Analytics | | nathangdavidson
Nathan0 -
Goals tracking across subdomains
Hi all, I'm having some trouble with regards to setting up goals tracking in Analytics across subdomains and was hoping that someone could help me out. Okay I work for an insurance company and we use a Quote & Buy portal for our insurance policies. Our website - www.example.com sends the traffic to quotes.example.com. Both of these sites have the same Google Analytics tracking ID. The quotes.example.com has no duplicate URLs which appear one our website, therefore I only set up the account to only include the hostname for each. Does this sound correct? The goals issue is if I now set up a goal in the quotes.example.com account, someone comes to www.example.com via Google and then clicks through to our journey and completes, will this count as a referral from www.example.com or as a goal from Organic? I'm totally stuck so any help would be appreciated. Thanks Ben
Reporting & Analytics | | Markerstudy0 -
Tracking Clicks on a Global Header Across Multiple Sites
Hey All, A particular client has multiple websites and we're planning on implementing a global header across 15+ sites. I've been looking for a way to track the clicks on this global header across all sites (that is that they are summed up), what's the best way to go about this if I am using Google Analytics (I know Adobe site catalyst could do this no problem with some advanced tweaking), any ideas? I could do the general click tracking route and tag every link but that will only help me if I do that for each site (that being said, if the global header for all sites pulls from a single HTML, then tagging it would technically count all the clicks from all the sites, the only caveat being that I'd have to pick which Google analytics profile I'd want to track the header with). Thoughts? Thanks!
Reporting & Analytics | | EvansHunt0 -
Analytics not tracking traffic from Old Domain Redirect
We've recently 301 redirected one of our client's domains to their new website and the strange thing is, we aren't seeing an increase in traffic in analytics. You would expect the traffic to increase roughly by the traffic volume from the old domain. There were a few hundred redirects and we tested a large sample and the redirects have been implemented properly. Is there something that we did incorrectly in our implementation of the domain redirect? Or is there something else that we need to do in Analytics to properly track those redirects?
Reporting & Analytics | | ATMOSMarketing560 -
Cookies/Tracking/Code developement
So. I have an online application form, on the website. It's maked with php, html and css. What i like to place on the email, is a cookie tracking system. For example, when someone search on the google for " web design ", and then see my result on google organic, comes the visitor to my site, charge the fields of application forms and click send. Than, me like an admin, i receive an email with informations of a customer, i see name/surname/etc.. but i like to integrate is for example, like to see a: IP from Visitors, who charged the fields Referrerr, if google, like to see which query he typed. How can i do this please?
Reporting & Analytics | | leadsprofi0 -
Track banner ad with google analytics
Hi We have a top banner ad on an external renown site only to attrack traffic. It does show up in google analytics, but i have seen some increase in (direct) / (none) traffic. Is there anyway i can track it when banner is showed from 2 separate URLs http://www.tv2torget.no/bedrift/netthandel/ and http://www.tv2torget.no/bedrift/netthandel/barneklaer/ Thanks Dan Lærum
Reporting & Analytics | | danlae0