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
-
Tracking specific path and referral for unique session
Happy Monday everyone! We recently received a unique lead on our site and I was wondering if there was anyway to pinpoint the exact behavior flow and/or specific referral source they came from on Google Analytics. I know you can view the general behavior flow for all or segmented users based on what pages they viewed, but I wanted to see if I can track by unique sessions to see where this person exactly found us. Any insight is appreciated! Thanks
Reporting & Analytics | | KathleenDC0 -
Implemented Enhance Ecommerce but Event tracking showing double
Hi, Today i have implemented Enhance Ecommerce with GTM everything working fine but in google analytic > Behavior > Events here all events figure i see double - triple so not getting exactly what is the issue. Thanks!
Reporting & Analytics | | varo0 -
How can I track my rankings on Google Images?
I noticed a small amount of traffic coming from a particular very generic keyword. Being pleasantly surprised that we are ranking for this, and after some digging, I found that we are actually ranking in Google images, rather than in the web results. How can I track whether other keywords are ranking in Google images? I use Rank Checker to track keywords in the main web results, but this doesn't have a function for Google Images. Help please - thanks.
Reporting & Analytics | | TheJewelleryEd0 -
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 -
Should we add the city to our keywords for a site that is only local?
This is one of those things I have done for a long time and all of a sudden asked myself was it necessary: For our local clients, we add the city name (Houston, KC, Birmingham) after each keyword. An example would be TestSite.com/big-tester-houston A Title Tag might be Big Tester Houston | Test Site, etc. Where appropriate we do the same with H1 or H2's and occasionally in the content we will use the city name. The thought being that since the site is only for a given city, it will be deemed more relevant than a site from outside.( I understand there are other factors in SEO; this is a specific question around adding the city). Yes, we also optimize with local directories/citation sites. Is this overkill, is it even worthwhile? Is there any evidence one way or another? I would love some strong opinions backed up with something other than anecdotal evidence where possible.
Reporting & Analytics | | RobertFisher0 -
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 -
Campaign tracking and duplicate content
Hi all, When you set up campaign tracking in Google Analytics you get something like this "?variable=value parameters" in the URL. If you place such a link on your site as an internal link, will it be considered as a different URL and will have its own link value? The question I have is, since Google knows it's a Google link and knows the original URL (by stripping the tags), does it pass link value to the original URL? If not, what can be done to pass link value? Thanks in advance. Henry
Reporting & Analytics | | hnydnn0 -
Custom GA tracking and link value
Hi I'm working on a real estate agents web site which has a lots of links coming from paid listings in real estate linstings sites (this in France so I'm not sure examples will mean anything but basically the agents have 900 house listings in each site and each listing has a backlink) In analytics these are classified as referals and that's fine for the moment But because sites provide different types of links, we are considering tagging all paid links with analytics utm codes. Mainly to learn which ads are actually providing qualified traffic (providing contacts). I'm guessing that currently these links, there are thousands, bring seo value to my client's web site and are not considered as paid links. Will adding the analytics codes to these links cause a loss of their value by clearly indicating to Google that we paid for them? What's the current thinking on this? I'm tempted not to be worried about being honest about the origin of these links but I'm worried that there is a real danger of loosing current ranking Any arguments FOR tagging paid links ? Thanks for you help Neil
Reporting & Analytics | | NeilInFrance0