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
-
If website users don't accept GDPR cookie consent, does that prevent GA-GTM from tracking pageviews and any traffic from that user that would cause significant traffic decreases?
I've been doing a lot research on GDPR impact and implementation with GTM-GA for clients, but it's been 12 months since GDPR has gone live I haven't found anything on how GA traffic has been impacted if users don't accept cookie consent. However, I'm personally seeing GA accounts taking huge losses in traffic since implementing GDPR cookie solutions (because GTM/GA tags aren't firing until cookies are accepted). Is it common for websites to see significant decreases in traffic due to too many users not accepting cookie consent? Are there alternative solutions to avoid traffic loss like that and still maintain GDPR compliance? It seems to me that the industry underestimated how many people won't accept cookie consent. Most of the documentation and articles around GDPR's start (May 2018) didn't foresee or cover that aspect properly, everything seems to be technically focused with the assumption that if implemented properly most people would accept cookie consent, but I'm personally not seeing that trend and it's destroying GA data (lost traffic, minimal source attribution, inaccurate behavior data, etc). Thanks.
Reporting & Analytics | | Kickboard2 -
Do lots of event tracking via tag manager will it slow down my site?
Hi All, For my Ecommerce site I have done lots of tracking total I do have total 45 event tracking but many times one event, track many pages. So if visitors click on url or button then do my site speed affect because of these trackings? Thanks!
Reporting & Analytics | | pragnesh96390 -
Tracking Product Codes
Hey Mozzers, We are improving our B2B site by adding product codes to headings & meta information etc to gain some traction ranking for our own products and those supplied by others when searched for by product code. Almost immediately we are hitting the top half of the first page for most of these and seeing some nice results. We would like to track our placement for these product codes in google but feel this would be a waste of our Moz Keyword limit and we really dont need to check them once a week, just one a month or so. Has anybody got any methods of tracking our ranking for a a big list of keywords say once a month which isn't too labour intensive? Many Thanks
Reporting & Analytics | | ATP0 -
Universal Google analytics e-commerce tracking code?
Hi Mozzers, I have never setup a universal google analytics e-commerce tracking code before and my concern is what exactly do I need to add on the cart thank you page? Can someone send me a sample of code I need to be adding? What kind of customization does it require? The more details you can provide the better! Thanks!
Reporting & Analytics | | Ideas-Money-Art0 -
Tracking in Google Analytics
My site has just recently (or maybe not so recently...) had a great deal of https URL's indexed (I was really only able to find this out thanks to the recent update to the GWT Index Status). It appears that Googlebot picked up an ssl somewhere (I already know where) on my site and then proceeded to crawl and index pages with https rather than http. Since I understand the issue, it should be an easy fix. My question is, does Google Analytics support (track) both http AND https for one site, or would I need to set up two different tracking codes for http and https? I figured that I might as well grab some data from the https pages that are indexed before I try and remove them. I've done a little research on using Groupings/Groups but I figured I would reach out to the MOZ community to see if anyone else has worked with a similar issue. Thanks!
Reporting & Analytics | | GalcoIndustrial0 -
Google Analytics Tracking Code Problems
I am having a problem with my Google Analytics tracking codes. The relevant GA tracking codes have been entered into the source code of certain sites I'm running campaigns on, but Google Analytics is still telling me that the tracking code hasn't been installed - yet it has. What could possibly be the problem here? I have checked that these sites don't run off multiple domains, and that the tracking code has been entered in the correct place within the source code - and yet I am still having problems with GA. Any suggestions?
Reporting & Analytics | | WebhouseISP0 -
Event Tracking Not Working
Hey there. Could use some help in figuring on why the event tracking code on this site http://www.baltimoreareahondadealers.com is not working. There is code on all external domain links but none seem to be firing. Inspect all the map links to view code ie. Search New Honda Inventory What am I missing? Thanks so much. -Caryn
Reporting & Analytics | | Caryn0 -
ECommerc site redirect to external site when add to cart. Need HELP to track sales!!!
Hi, I buil this site on WordPress, http://www.pilatesboisfranc.com When you go on <<plan &="" pricing="">> on the menu you can purchase a package online.</plan> When you click ''Get Started Now'' or ''Add to Cart'' the buyer is redirect to this external site: mindbodyonline.com QUESTIONS: Can I track my sales on Googles Analytics? Can I creat a goal on G.A. ? I found this video: https://getsatisfaction.com/mindbody/topics/chalk_talk_how_to_setup_google_analytics Is this the right way to do this? About goals, a simple goal I would like to create is, one purchase. Can I acheive that? Not shure about Goals. When I test and purchase, URL is always the same https://clients.mindbodyonline.com/ASP/home.asp?studioid=30371 I'm know only very basics stuff when it is time to play in Analytics, I hope you can provide help in details. Thank you, BigBlaze
Reporting & Analytics | | BigBlaze2050