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
-
Domain change from .co.uk to .com - do you add .com to the referral exclusion in GA?
Hi Mozzers, Just wanted to double check that when a website domain changes from .co.uk to .com - do you add .com to the referral exclusion in GA? Do you also keep the .co.uk version in the list too? I have updated the property settings to .com Thanks Anthony
Reporting & Analytics | | Tone_Agency0 -
Analytics - Video Tracking
Hello, As i've ended up confusing myself, I thought I would ask the moz community whether i'm on the correct track! I'm wanting full GA tracking on individual videos from our destination URL. In short I need the name of each video to have specific tracking. Example;
Reporting & Analytics | | Whittie
Video 1 (Apples)
Video 2 (Oranges)
Video 3 (Pears) We need to be able to see the amount of plays per session, per video. As well as any extras if possible, such as;
Watched 25%, watched 50%, watched 75%, video complete, video paused. If the following script is used; https://github.com/sanderheilbron/vimeo.ga.js As well as using the Google URL builder (https://support.google.com/analytics/answer/1033867?hl=en-GB) , what would be the best way to set each video to see the statistics within Google Analytics, so I can see how many plays the 'Apples' video has had. I think it is the ordering of the 'event, campaign, label etc' which has confused me. Many Thanks for any replies in advance, I appreciate it.0 -
Showing Button Clicked in Google Analytics - How to check which button has been clicked?
For my E commerce site in my google analytic in Event Action it is showing "Button Clicked" and Total Events 4005, so i want to know visitors have clicked on which buttons?
Reporting & Analytics | | bkmitesh0 -
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 -
Large event site - how should I structure my URLs?
Hi guys, I'm working on a new website which is consolidating a number of existing event sites into one. The existing sites use a variety of URL structures: www.eventsite1.com/events/event-name www.eventsite2.com/festival-program/event-name www.eventsite3.com/event-name This inconsistency has led to issues with tracking category usage properly in analytics - for instance, with eventsite3.com, events fall within categories (www.eventsite3.com/category-name) but as soon as you drill into an event detail page (www.eventsite3.com/event-name) from the category page, the category is lost to analytics. This is compounded when one event lives within multiple categories, as I can't figure out which category is the most effective for a particular event. I've seen other event sites establish a canonical URL for a primary category, display it in the URL (i.e. www.eventsite4.com/primary-category/event-name) yet still let that event get hit via the secondary categories (www.eventsite4.com/secondary-category/event-name). This way, the categories get passed to analytics without any duplicate content issues (i.e. via the setting of canonicals) Basically, I want to make sure that whatever instruction I give to the devs for the new site re: URL structure is correct from an SEO perspective and analytics perspective. Do I even need to worry about having the category in the URL? Can someone please help me with this? Hope this makes sense Cheers
Reporting & Analytics | | cos20300 -
Tracking PDF Downloads in Google Analytics
Hi, I work on a site that allows users to download whitepapers after filling out a form. Once they do this they are redirected to a URL which is the PDF. We use Wordpress and these documents were uploaded to the media center. I've tried researching how to track these downloads in GA, since the code is not present on these pages, but have read a few different answers. Anyone have firsthand experience? Thanks!
Reporting & Analytics | | tinarose0 -
Tracking Required Form Fields in Google Analytics
I tried searching for this elsewhere but am having a hard time finding a good answer. Is it possible to track the effect of required form fields on conversions in Google Analytics? In other words, how do I track whether or not more/less people fill out a form if I make "Last Name" a required field? Thanks 🙂
Reporting & Analytics | | kylesuss0 -
Google Analytics should track users from iPhone App
Hi Mozzers, you say there are no dumb questions, here is one. We've build an iPhone App for our Website working-dog.eu. So users can read there new messages with ease when they are out of the office, read about breeds, ... do all the nice stuff they want. I don't think so, but is it possible to track these users with Google Analytics? When the come via App, the Analytics code will not run for them. But maybe it could start an AJAX request or something like this? But how should the code run, without a browser which can interprete JavaScript? So, in short: Is it possible to track users from iPhone App with Google Analytics? Kind regards Patrick
Reporting & Analytics | | mdoegel0