How To Track Anything With Google Analytics Event Tracking

A lot of you have asked me how I track things like affiliate link clicks, email signups and such things with Google Analytics. The short answer is with Google Analytics event tracking!

So I decided to put a quick Google Analytics event tracking tutorial together to show you how you can do the same.

What You Will Learn

  • How to track anything with Google Analytics
  • Including affiliate clicks, email sign ups, shopping funnels & more
  • How to setup event tracking & goal tracking
  • All of my Google Analytics event tracking best practices
  • How to work out the monetary value of a conversion easily
  • Get access to my personal custom Google Analytics report

My previous tutorial will also teach you how to increase traffic with Google Analytics.

Google Analytics Event Tracking Tutorial

Don’t worry it is much easier than you think! Just follow along with my live Google Analytics event tracking example-


Video Transcript

Hi guys Matthew Woodward here and today you are going to learn how to track anything with Google Analytics event tracking, I know a lot of you have asked for this so here it is.

You will learn how to track affiliate clicks, email sign ups, shopping carts and much more.

I’ll also teach you how to work out the monetary value of an affiliate click, email sign up or any other action in seconds.

And I will be sharing my personal custom report that I use to work out which traffic sources and which content is driving the best conversions!

Let’s get stuck in.

This is the main dashboard for my blog in Analytics and if we come down to content, events, we can see its tracking all sorts of different events including affiliate clicks, downloads of resources, people subscribing to RSS and the lead player videos also seem to create their own events automatically for you so you can see when a video has been loaded, played, the optin displayed, how many people submitted on the optin and things like that.

If we click into the affiliate event category and look at the label we can see exactly which pages have driven how many affiliate clicks over a time period and we can come and take a look at exactly which programs have received the most affiliate clicks.

Moving on from there you can then setup goals and goals allow you to attract the conversion rate of such things along with here we can also see people subscribing to the email list and if you come up here you can track that kind of information here.

Other things you can do once you’ve setup events and goals, you can setup custom dashboards for example I’ve got an email sign up performance dashboard here and exactly where the sources are coming from and which pages are driving that.

You can also use just an easy dashboard here that’s tracking everything for me. Email completions, affiliate clicks and resource downloads.On top of that you can actually create your own custom reports and if you take a look at this I actually create a report to measure the performance of traffic.

So you can see things like blackhatworld send 3.98% conversion rate to email subscriptions whereas warrior forum is 10.92% and trafficplanet 3.37% so you can quickly see where you should spend your efforts if your key goal is to drive email subscribers and we’ve got the same here for affiliate clicks.

People from youtube 46% of them clicked an affiliate link whereas only 25% from blackhatworld. And again I can come and now look at the same metrics broken down by content and see exactly which content is driving email subscriptions, affiliate clicks, resource downloads and such things.

So this custom report you’re going to be able to download underneath the video on my blog. You’ll be able to add it into your analytics setup in just 1 click and I’m going to take you through now how we setup and track all of the different events which include the affiliate clicks, resource download, rss subscriptions and I’ll show you the leadplayer video integration because that’s pretty easy as well.

And then once we’ve done that we are going to setup the various goals which will allow us to track all the conversion rates and build our custom reports. So let’s get started.

Event tracking can be used to track anything that the user clicks on, this can be anything like an affiliate link, clicking a buy button and so on.All you have to do is add this code to your links, don’t worry if it looks scary at the moment its really simple to apply.

If you look at the code we want to replace 3 values, the category, action and label. The category is the category or type of event such as affiliate click or video if you’re tracking video plays etc

The action is just a name for the action user takes, this could be play if tracking video but I use the affiliate programme name here if tracking affiliate clicks.

Lastly the label can be anything you want, I use the page URL here though.

Let’s take a look at a live example, this is what the event tracking code template looks like.

And this is what the code of an affiliate link looks like for Ahrefs.

The edited coded looks like this, you can see the ‘Category’ has been changed to Affiliate, the Action changed to the affiliate program which is Ahrefs and the label has been changed to the pages URL.

And you can see the difference between the normal affiliate link and the finished product, essentially what we have done is just copy and paste the onclick statement into the link itself.

And what that produces is when you come to event category it says affiliate and then you can look at the event label which is the URL or the event action which in my case is the affiliate name. So there is ahrefs, the label we set and here are the different labels or URL that are sending that affiliate program traffic.

Now if we come across to my blog here and here is an affiliate link, you can see this in action live and you can see here the onclick track event affiliate Bluehost and the URL its coming from.

And I also have this if you download, share the page socially and download one of these packs if we inspect that you can see here this time instead of affiliate its download, the resource number so this is resources number 1, thats number 2, thats number 3 tutorial resources 1 and the URL its coming from.

And we can also come and take a look at the RSS here, inspect element. Trackevent, RSS, subscribe the URL its coming from and I have this in place on every single affiliate link on the blog which I have to setup manually it does take a bit of time when producing a posts like this kind of thing but as you can see its well worthwhile doing.

Let me just show you here again, inspect the element and there you can see trackevent, affiliate, seopowersuite, tools of the trade even these links track event, affiliate, so every single link here is tracked.

It’s worth spending the time setting all of this up and once you have setup all of the events for things that involve a click you can move onto the next part which is setting up the goals and we will also look at setting up the tracking of email subscriptions and that kind of thing which we don’t need to add any special code to do.

Once you have set things up and you’re getting data coming through in the events section here, it will take about 24 hours for data to appear once you’ve set everything up but then you need to move into creating goals for the events you have got.

So to do that you come into the admin section, select the profile and come to goals and you can see I’ve got some setup here but I’m going to show you quickly how to create a goal.

So tracking or creating the goal for the affiliate click, we have a few options here i’m just going to choose custom and hit next step. You can give the goal a description so that might be affiliate click and you can change how you track it.

So we want to register a goal every time the affiliate event happens. So we can select event, hit next step and now it allows us to choose a category, action or label that we have defined earlier.

Now we know we called our category affiliate for all of the affiliate links and we can just quickly verify this goal and it tells us that 5.58% of people in the last 7 days have met this criteria so we know its setup correctly. You can also define a value for a goal conversion so every time a goal happens you can assign a monetary value to it.

Now this is often hard to do with affiliate clicks because you don’t know many of those convert and everything like that but I’ve actually got a little formula that I’m going to teach you a little bit later on in this tutorial to work out what value to put into things like an affiliate click or email sign up or things like that.

Anyway once done you would click create goal, I’m not going to because mine are already setup but then if you then wanted to setup a goal to track RSS clicks, again similar setup, custom, next, RSS, tracking an event, category is equal to RSS verify this goal and we can see that matches.

So setup your goals for each of the events that you have setup and then you can look at setting up the email subscription tracking.

Now tracking the email sign ups is really easy on my blog no matter where you sign up, whether it’s this form here, this form here or one in line with posts as soon as you hit subscribe now you get taken to this page which asks you to check your email and click the confirmation link.

Pretty standard procedure really and this url is almost-done now the only way to get to this page is by submitting a form. So anyone that hits this page has had their email added to aweber and now they just need to login and confirm it.

Once they open the email and click the confirmation link they get to this page, thank you for signing up. Their email is now confirmed they are on my list ready to receive my emails.

So no matter what happens people must always hit the almost-done page and then lastly the thank-you page and make a note of the URL’s there.

So in Google Analytics to track the email sign up all we need to do is click on create a goal, here we can select a sign up, next step, give it a description so email subscribe and then this time we are going to choose destination as the type and hit next step.

Now the final destination, the point that the final conversion takes place is after the user has confirmed their email address. Once they hit this final page in the sequence. That counts as an email subscription.

So you can take that URL and paste it in here. You can give it a test here and double check that’s working and you can see 0.92% of people in the last 7 days have hit this page.

You can then define a funnel and what happens is, no matter what page they come from. They always come to this page and then they always go to that page. This is the email sign up funnel.

Enter your email address, please confirm your email, thank you for confirming. So if we take the URL of the almost done page we can say that first they have to hit the please confirm stage and this is the page that they will see and it is a required step.

So in order for this to register as someone subscribing to the email list, they must hit that page then they must hit that page and that counts as a valid subscription.

Again you can reverify here to make sure your new funnel is working and here you can see that 0.92% conversion rate. So you would just click on create goal and that is the goal completed for you.

It’s also worth noting that you can use this setup to track any type of funnel whether that’s an ecommerce funnel and a checkout when someone’s added a product to a basket, views the basket, checks out and then thank you for order page.

You can track any funnel with this and as you can see here you can add and remove steps as you wish. Not everyone takes people to a please confirm your email page, you might go straight from the opt in to the thank you with no confirmation. In which case you could just remove this step and just have it tracking directly from here to here.

So feel free to tweak this goal setup and create funnels for any type of action the user may take on your site. It’s not just limited to email subscriptions in fact back here you can see the different things they recommend you track.

So let’s move onto assigning goals a value and how to come up with a monetary value for each metric that your tracking. Now putting a monetary value on goals is a great way to get a rough indication of how the site is performing. It’s not an exact science it’s just a guidance and this is something I haven’t really set up on this blog so let’s do it right now live with you guys.

So I have got this spreadsheet and you can see this is the performance of the blog across the last 3 months and how much it has generated and what I want to find out is how many affiliate clicks did I have in that same period and how many email signups.

So if we jump to analytics and come to conversions and goals and overview and the data period is the same, 1st of April to the end of June. You can see there were 892 subscriptions to the email list in that time and we put that there.

And there we 6276 affiliate clicks in that time. Now as a rough estimation you can take the total amount of money earnt in that period and divide it by the number of affiliate clicks to work out roughly how much each affiliate click is worth so we can say equals that divide by that and each affiliate click is worth to me about $3.32 and you can do the same formula for email sign ups.

And an email sign up is worth to me around $23.38. Now I know that this is not an exact science because this number isn’t really broken down like this and this calculation assumes there were no email signups or now affiliate clicks they are totally independent of each other.

But it’s a nice way to put a rough kind of estimation on what each of these events or goals are worth to you. So adding an event in or the value to the goal in is pretty easy. You can come back to goals here and this is my affiliate link goal right now and I can say yes, oop sorry use the event value as the goal value for the conversion, no and my custom affiliate click value is $3.32 so I can change that there, save goal.

And now to email list I can come here, value, on and the value here was 23.38 and hit save goal and from this point onwards analytics will now track that goal value you can see here I just had random values assigned previously I think it was $1 on the email sign up at $0.10 on the affiliate clicks so it wasn’t really based on anything.

But now from this day on it will track the value I have just inputted based on the last 3 months actual performance of the blog.

So that’s how you put the value against goals so just to recap your knowledge quickly. The other week I integrated LeadPlayer Videos which introduced all of these cool events allowing you to track when a video was loaded, when it was played, when an opt in displayed, when a call to action was displayed, how many people clicked the call to action and so forth.

But I haven’t actually added these as goals yet, so let’s take a look at how we do that. If we jump over to goals, the first goal I’m going to track is the call to action click which in essence is an affiliate click so we can create a goal.

Custom, and call it video affiliate click and we are going to track an event which is equal to the category leadplayer videos, the action is calltoaction-click and the label I’m not bothered about what does it actually track as the label, ahh exactly which page it came from.

So we know that an affiliate click is worth roughly $3.32 to us so we can add that as a value here, verify this goal and this will check and tell us the conversion rate that we are seeing here and click on create goal.

Now I want to do exactly the same but this time for video opt ins. So this time we are going to go sign up, oh no custom, video optin and that’s going to be an event, next step.

Again here the category we can come back and check leadplayer videos check that’s right, yep. And we are looking for the event action optin-submit and just verify that quickly and you can see that’s working nicely there and the goal value is going to be $23.38, create goal.

So now you can see I am tracking also my video affiliate clicks and video optins based on the events that leadplayer was automatically pushing into here and as you can see I’ve not actually been using it that long just yet.

So now you’ve got it all setup you can come and download my custom report the link to do so is available underneath the video on my blog. You’ll be able to import this exact report in one click that breaks down the performance of first of all your traffic sources and then it allows you to easily identify which ones click on affiliate links more and which ones sign up to email lists more and such things.

You’ll also be able to analyse your content and see exactly which content is driving more email subscriptions and which ones are driving more affiliate link clicks.

Once you import this into your analytics account if any of these numbers aren’t showing what you need to do is come up to edit here and just change these fields.

So if you click on this drop down, select email you’ll want whatever your goal for email list completions is here and here whatever your goal name is for email list conversions here. So email completion, email conversion, affiliate completion, affiliate conversion you probably won’t track resource downloads this is custom to what I do so I will actually remove these before I share this report with you.

So that’s it now you know exactly how to track everything with analytics, go and get it all setup!

Essentially you can track anything that happens on a website from someone click on a link to someone converting as an email subscription.

Here is a basic example of how to use event tracking to track affiliate links-

The default Google Analytics event tracking code looks like this-

onclick="_gaq.push(['_trackEvent', 'category', 'action', 'label']);"

We want to replace 3 values-

  • Category – The category/type of event, e.g. Affiliate Click
  • Action – Give the action a name, eg click (I use affiliate programme name here)
  • Label – Anything else you want to include (I use the page URL)

So track an affiliate link click for Ahrefs on the tools of the trade page it would look like this-

onclick="_gaq.push(['_trackEvent', 'Affiliate', 'Ahrefs', '/tools-of-the-trade/']);"

Now we just need to add it to our usual affiliate link that looks like this-

<a href="https://www.matthewwoodward.co.uk/get/ahrefs/">Ahrefs</a>

Which ends up looking like this-

<a href="https://www.matthewwoodward.co.uk/get/ahrefs/">Ahrefs</a>

Everytime someone clicks on that affiliate link, Google Analytics event tracking will log it was an affiliate link click for Ahrefs and the page it came from.

Please see the video for more detailed setup instructions and learn how to track other things like email subscriptions, signups & shopping carts!

Custom Reporting With Events & Goals

Once setup you can create custom reports that tell you a bunch of things like-

  • Which traffic source sent the most opt in conversions
  • Which page converts the most affiliate clicks
  • Which affiliate program is performing the best for which traffic source

This is what my custom Google Analytics event tracking report looks like (you can get it below)-

Google Analytics event tracking tutorial example report

Straight away you can see 10.9% of traffic from the WarriorForum signs up to my email list while only 3.4% do from TrafficPlanet.

Equally you can see 46.1% of YouTube traffic clicks an affiliate link compared to just 25.8% from BlackHatWorld.

Take a look at this forum post or this post to learn more about why that is important to know!

171 Responses

  1. Dean

    dont think the google + share button is working, i shared it and got nothing, the page just reloaded.
    cool tutorial though, im looking forward to trying it out, i want to scale my traffic by buying advertsing slots but I am unsure on how to go about it. this may help a lot.

    • Matthew Woodward
      July 5th, 2013 at 5:55 pm


      Fixed :)

  2. MixerDJ

    Better if you can show How to set up Google Analytics account for web site with video :P

  3. Fernando

    Matt, good post, one thing you should do is track your email links… I noticed you are not doing it… just a suggestion.

    How are you creating the tracking events? Manually or with Yoast SEO plugin?


    • Matthew Woodward
      July 6th, 2013 at 8:01 am


      Yeah my email tracking sucks, I have an old aweber account that doesnt even tell me open rates ^^

      I’m setting it all up manually, Yoast tracks outbound links – but mine redirect through an internal link first

  4. Charles Floate

    Just seen the full video – Like to point out that in the Email Signups Dashboard, your #5 referer was my other site – SerpChirp xD

    • Matthew Woodward
      July 12th, 2013 at 9:57 am

      Winning =D Thanks for the traffickz!

  5. Frank

    Hi Matt,
    Isn’t this easier with Google’s URL Builder tool? Or is not the same thing?

    • Matthew Woodward
      July 6th, 2013 at 7:59 am


      That is for custom campaign tracking like when you send out an email or buy banner advertising etc

  6. Batuhan SASI

    Hello Matt

    That is AWESOME. I was waiting for this

    Thank you so much


    • Matthew Woodward
      July 6th, 2013 at 7:58 am

      Cheers Batu

      • Batuhan SASI
        July 6th, 2013 at 12:44 pm

        I want to share something for WordPress (aka Php) sites.

        You can use this code for Label .

        onclick=”_gaq.push([‘_trackEvent’, ‘Affiliate’, ‘Amazon’, ”]);”

        • Batuhan SASI
          July 6th, 2013 at 12:45 pm

          onclick=”_gaq.push([‘_trackEvent’, ‘Affiliate’, ‘Amazon’, ”]);”

  7. Chris

    Another top post by Matt. It’s always worth being able to track as much as you can on Analytics.

    • Matthew Woodward
      July 12th, 2013 at 9:56 am

      Then you can make awesome posts like the one I’m going to write this afternoon :P

  8. Batuhan SASI

    I’m sorry Matt. I cant write php code here. It’s SERVER[REQUEST_URI]

    • Matthew Woodward
      July 12th, 2013 at 9:55 am

      I know what you are getting at, but within posts you can execute PHP by default ^^ I use this trick in my siderbar for the RSS link thoguh

  9. Adesanmi Adedotun

    Very nice guideline on to have full access one Google analytics report

    • Matthew Woodward
      July 12th, 2013 at 9:50 am

      Cheers Ade!

  10. Ileane

    Hi Matthew,

    I left this question on Google+ but I’ll also ask it here.

    First off, thanks for the tutorial. I’d like to set up event tracking for when a podcast is played. I have 5 audio podcasts files on one page and I’d like to know which one is being played the most and where the traffic is coming from who actually listen to the podcast. How will I use the event tracking code with the HTML5 iFrame embed? 

  11. toobie

    Hey matt, great post!
    How do you lock your contet with social signals like that?
    Could you please give me a search query or something to start with? :)


  12. Iain

    I love this tutorial.

    It something so simple and yet people often forget to do it.

    I mean there was even a part that you forgot to do.

    Goal tracking. It’s so important.

    • Matthew Woodward
      July 15th, 2013 at 11:31 am

      Which part did I forget to do?

  13. eman

    Are you okay with Google analytics? A lot of people stay away from it now. I found Piwik and it’s fantastic.

    • Matthew Woodward
      July 15th, 2013 at 7:54 am


      Yeah have used it for years, why wouldn’t you use it?

  14. Anonymous Affiliate

    Hi Matt

    I have tried to something like this in the past but failed miserably!

    All my affiliate links end “/exit.php’ so I set up a goal in G.A. to record all clicks on URLs containing ‘exit.php’… It’s never recorded a thing.

    Any tips as to how to fix this?


    • Matthew Woodward
      July 16th, 2013 at 8:42 am


      Did you put the analytics tracking code within the exit.php file itself?

      If not it can’t register that page was viewed, you need to setup event tracking as per the tutorial here

      • Anonymous Affiliate
        July 16th, 2013 at 8:47 am

        Ah ok, I didn’t know that.

        That might be one I’ll have to get my developer to try and look at that, unfortunately I am not so technical as to be amending that type of file!

        Thank you

        • Matthew Woodward
          July 22nd, 2013 at 8:32 am

          Let me know if you get stuck!

  15. Rencontre

    Thank you for this tutorial. I don’t really track much in general, just use statcounter to see what queries or where the traffic come from.
    But now you convince me to us GA and it’s free. Can’t beat that.

    Question: What is the plugin you use to display the “Subscribe to my award winning blog now” ? I like how it goes down when you scroll.
    ( I subscribed btw : )

  16. Andrea

    Hey Matt, what did you eat in the morning?? Gallo pinto?? Share your secret please, how can you be so smart?? I have to stop reading your blog, because it make me fill i miss something every day. Thx for your share buddy!!

    • Matthew Woodward
      August 13th, 2013 at 4:18 pm

      Hahah hopefully in a couple more weeks I will be =D

  17. Carolyn

    Hi matt,

    How can I set this up to show if my clients SEO is working. They are confused with PPC and SEO and he is spending 4200 a month on PPC also. It has its own landing page and phone number. But, her Analytics report is the standard mess that Google gives you.

    • Matthew Woodward
      September 8th, 2013 at 2:51 pm

      What are the goals of the campaign?

  18. Luigi

    The best video I’ve watch when it comes to this specific topic Goals, Events and funnels.

    I wish I could find a video about how to insert the onclick=”_gaq.push([‘_trackEvent’, ‘Affiliate’, ‘Ahrefs’, ‘/tools-of-the-trade/’]);” code in the actual page.

    Do you know one?

    And thanks again.

    • Matthew Woodward
      October 6th, 2013 at 9:35 am

      The video explains that?

      • luigi
        October 6th, 2013 at 6:05 pm

        But i think it a little bit different depending on the theme you are using for your site. Right?

        • Matthew Woodward
          October 7th, 2013 at 9:08 am

          Nothing to do with theme, just use the post editor that we all have in the back end of worpdress.

  19. Promes

    Hi Matt,
    Thanks for an awesome article. I tried to implement the tracking code, but the links I want to track come from shortcoded buttons (example: [large_button color: red link:x**] ). Do you know how I could manage that without having to lose the shortcodes of my wp theme? Btw, I tried to put the code in the shortcode, but obviously it doesn’t works.

    • Matthew Woodward
      November 11th, 2013 at 10:23 am

      You would need to edit the plugin that you are using for the shortcode

  20. Casey D

    Just set up your custom report with my analytics. This is something I’ve been wanted to learn but never got around to actually taking the time to learn how to do it.

    Thanks for sharing, Matt!


    • Matthew Woodward
      November 10th, 2013 at 12:39 pm

      No worrys glad it helped you out :)

  21. Damian Appleby

    If you want to add call tracking for free (so you can see call events), you can add a tel: anchor tag round your number and add the event trigger to that – this will only work on smart phones or Skype, but on some the sites I’m involved with that can be as many as 30% of the visitors, so with a little judicious analysis you can pick out the key phrases that have generated telephone calls (along with everything else)

    • Matthew Woodward
      December 18th, 2013 at 10:23 am

      Now that is a sweet tip :)

  22. Steve

    Tnx nice video, works perfect for me the affiliate clicks. I have one question, at the 3.56 in the video what is the Event Category number 5. Page Exit do? Is the moment when the visitor hit the x button in the browser?

    • Matthew Woodward
      January 17th, 2014 at 11:08 am

      This is how many people left the site at that page.

  23. Panks

    Hey thanks a lot , Lots of info provided you, Its a great help . But you didn’t mention about the downloads .

    Is it right that i will track a download by puting the event code on my Download Button and then set up a goal for thank you page.

    I mean when anybody download my software if fire a event and for the successful installation we have thank you page. So should i have to do that.

    I m still very confused ..

    • Matthew Woodward
      February 3rd, 2014 at 10:08 am


      Just tag them the same as an affiliate link.

  24. Panks

    Hay Matthew ,

    I am doing each and every step as you mentioned , can you please take a look on my Download button and verify it if i have put right code .

    Site is http://goo.gl/cmvZrw

    One more thing what i have to do to track event for different page , i mean if i have multiple page and i want to tack my download button then on every page i have to put the same code or i need to change something in tracking code. Should i have to create different Events and setup different Goal for every page.

    Please guide


    • Matthew Woodward
      February 4th, 2014 at 9:58 am

      Looks ok to me, just check the data comes into analytics tomorrow.

      I’m not a coder by any stretch!

      You should read the official documentation regarding the best way to implement it.

  25. Ken McMahon

    Hi matt. I left a comment on the youtube video, but I’m reposting here in case you miss it. I’d really like to know the answer to this!

    How would this work with an iframe Amazon affiliate link that looks like the one below? There’s no html outbound link as such to which the analytics code can be attached.


    • Matthew Woodward
      February 8th, 2014 at 9:41 am

      YouTube really made a mess with the comment management/moderation with the Google+ integration so its likely I missed it sorry.

      Why would you use an iframe?

      • Ken McMahon
        February 8th, 2014 at 9:50 am

        That’s the format that Amazon uses for its enhanaced links. The specific ones I want to track are like those on this page


        Thanks for the quick response :)

        • Matthew Woodward
          February 10th, 2014 at 11:34 am

          Ahhh I see – I don’t think so, perhaps you could add the onclick event to the java easy enoguh but im not a coder. I bet someone on fiverr could drop it in though.

          • Ken McMahon
            February 14th, 2014 at 9:17 am

            Thanks, It’s the one piece of info I could really do with, so I’ll try and find a way. I’ll leave a comment if I manage to find anything worthwhile.

          • Matthew Woodward
            February 15th, 2014 at 8:00 pm

            Just outsource it – anyone that knows code thats like a 30 second job

  26. Matthew Woodward

    Thats what we are doing :)

  27. Mark

    Interesting stuff matthew however I got confused why you have mentioned you put affiliate links as event AND goals. ?

    • Matthew Woodward
      February 24th, 2014 at 9:32 am

      An event is basically just a fabricated pageview.

      If you want to measure conversion rates/conversion value etc then you need to map an event as a goal

  28. Rajesh

    I didn’t found custom report

    • Matthew Woodward
      March 6th, 2014 at 8:01 am

      Try reading the post properly

  29. Matthew

    Hi, Matthew.

    How can one get in contact with you? what’s the best way

    I have some questions regarding ‘How To Track Anything With Google Analytics’.

    I;m new to GA and so my questions would be elementary and possibly boring for you so you obviously don’t have to answer them if you don’t want to although it would really help me with conquering the learning curve

  30. Matthew Woodward


    Yes I will do at some point

  31. Rachel Saunders

    Hi Mathew sorry just wondering how come you mention affiliates wouldn’t have thought it would be as relevant…

    • Matthew Woodward
      March 14th, 2014 at 10:18 am

      I’m a full time affiliate ^^

  32. Matt

    Glad you mentioned that as I was wondering the same thing.

    I’m new to GA, so I don’t want to assume, but the way I’m interpreting it this is the “old” (ga.js) code:
    ga(‘send’, ‘event’, ‘category’, ‘action’);

    …and this would be the “new” Universal Analytics (analytics.js) code:
    onclick=”_gaq.push([‘_trackEvent’, ‘category’, ‘action’, ‘label’]);”

    Please correct me if I’m wrong. :) Thanks in advance!

    • Matt
      March 19th, 2014 at 3:16 pm

      Sorry, swap the two lines of code so top is new and bottom is old (changed the wording/structure of the post midway through).

  33. claude

    Hi Matthew,

    Very good your video about tracking anything with Google Analytics… What’s about google “no provided” issue.


    • Matthew Woodward
      March 28th, 2014 at 9:03 am

      Nothing we can do about that – keywords are so 2012 anyway :P

  34. Felix Albutra

    Hello Matthew,

    I find your video is really helpful to me. But still got one more question. I want to track the click events of my “Submit Form Button” which I used a third-party service like MachForm.

    How am I going to track that or simply how am I going to paste the tracking code inside the webpage?

    Please help me and thank you very much for the help.

    – Felix

    • Matthew Woodward
      April 30th, 2014 at 6:22 pm

      You will have to ask MachForm devs about that if you cant control the code

      • Felix Albutra
        April 30th, 2014 at 7:01 pm

        After the creation of the form, their form editor will then generate the codes for me to paste it in my webpage. I am thinking what part of script I will paste the tracking code.

        • Matthew Woodward
          May 1st, 2014 at 7:00 am

          You need a developers/coders help for that

  35. Ravi C

    What is the plugin you are using for the popup that comes to subscribe to your blog? I really like it..

  36. David Longacre

    Hey Matthew,

    I had this tutorial bookmarked. Went back to into implemented the tactics. Then realized after 2 weeks of not checking. This is the old way and this doesnt work with Universal Analytics. Would you mind doing an update with the new version?

    • Matthew Woodward
      July 25th, 2014 at 4:17 pm

      Ahhh I haven’t moved to universal myself yet sorry, but I will update it when I do :)

  37. Paul Ray

    Hi Matt,

    Whats the best way to add events to a wordpress website. Everytime i change it in my posts it gets reset by the WYSIWYG editor. The only solution I came up with is use a plugin like Google Analytic Events or using RawHTML to prevent it from changing. Thoughts?

    • Matthew Woodward
      August 14th, 2014 at 5:19 pm

      I don’t use the WYSIWYG editor personally =/

  38. lee

    Hi Matt,

    Is it possible to track Contact Form Submission as the last step in a funnel WITHOUT a thank you page? That is, I have 2 Google AdWords Campaigns, each with their own landing page. I set up the goal to track from AdWords to the landing page to the Contact page but I cannot tell if the contact form page was submitted as there is no subsequent thank you page – only text that pops up on the contact page. If I set up an event I can’t add it to the end of the previously described funnel, cany I?

    • Matthew Woodward
      August 20th, 2014 at 3:07 pm

      Hmmm I think if you got the submit button to fire off an event, you can set that up as a goal

  39. Will

    Hi Matt, awesome guide, is it possible to use the affiliate tracking code for image clicks (banners) (in wordpress that go to custom urls) that redirect to the affiliate page?
    Thanks for your help dude.

    • Matthew Woodward
      September 29th, 2014 at 4:17 pm

      You sure can – you can add the code to pretty much anything!

  40. Chaz A

    Hi Matt,

    Awesome tutorial. This cleared up a few things from the Analytics front.

    We have our own landing page which we drive ppc traffic, and the thing that I’m pretty stuck on at the moment is how to track conversions (postback/pixel fire on affiliate link LP) and attributing them back to the keywords that generated the conversions in the first place from adwords.

    Lets say we are using our own affiliate tracking platform such as HasOffers, how can I dynamically populate the keywords into the affiliate links and postbacks/pixels?

    Do you have any suggestions on this?

  41. Darrel Andrews

    WOW! Thanks for showing us how to use Google Analytics like a pro!

    This is exactly what I need to do on my blog, your email happened to pop up at the right time, too.

    • Matthew Woodward
      January 5th, 2015 at 11:07 am

      Hahaha funny how that works out sometimes!

  42. Craig

    Great video Matt,

    Do you know if it’s possible to add an event to an embedded youtube video, to track how many people press play?

    I’m going to look into this now, but figured I’d ask here too.

  43. Abhay

    When I add event tracking code in WP text editor and switch back to visual editor, WP automatically strips out that code. Do you know why that’s happening? My wp is up to date.

    • Matthew Woodward
      February 3rd, 2015 at 11:11 am

      I never use the visual editor

      • Abhay
        February 3rd, 2015 at 11:16 am

        That’s strange! But then what do you do if you need to add a shortcode or something using the navigation that we see in visual editor?

        • Matthew Woodward
          February 3rd, 2015 at 12:42 pm

          I just write the code

  44. Craig

    Hi Matt,
    Tracking affiliate links still works right?
    I’m having trouble getting it to work, but not just if something is conflicting with something, or perhaps because the links are PrettyLin links.

    • Matthew Woodward
      February 6th, 2015 at 8:14 am

      Yeah it does no problem

      • Craig
        February 7th, 2015 at 11:34 am

        Finally, figure it out.
        I was using “Google Analytics by Yoast”, for some reason the code you have above and code i found on other sites didn’t work.

        I had to use the following code:
        onclick="__gaTracker('send', 'event', 'affiliate link', 'product name', '/url-slug/');" rel="nofollow" target="_blank"

        Not sure if code will display in comment so here is screen shot.

        Thanks again.

        • Matthew Woodward
          February 8th, 2015 at 11:45 am

          Are you using legacy or universal analytics?

          • Craig
            February 9th, 2015 at 10:27 am

            Using universal, but for some reason only the code I posted works with Yoast.
            Even the code generated with gaconfig.com wouldn’t work.

          • Matthew Woodward
            February 11th, 2015 at 9:56 am

            There is a very handy Google Analytics debugger addon from Chrome that might help you out

        • Jody
          March 19th, 2015 at 5:46 am

          I’ve had a similar issue as well. I’m using Yoast for SEO and Analytics, but not all of my affiliate links are being tracked with the filter you can configure to track internal links as external links.

          I came here to find a workaround, so thanks for the comment. I’ll give it a try.

  45. Toby

    Thanks for the great tutorial Matt.

    Do you know of any WP plugins that can automate adding the tracking code values to links? I’m thinking of something similar to ThirstyAffiliates, which I’m already using for affiliate links.


    • Matthew Woodward
      February 10th, 2015 at 8:05 am

      ThirstyAffiliates can do it natively

  46. Fernando

    Great post Matthew.

    Small question, how do you track email subscriptions that come from popups?


  47. emily

    tried adding Event Tracking to various place on the following page but none are being tracked: http://exerciseo.com/author/alkavadlo/

    Are you able to see what the issue is and if the tracking code has been added correctly/incorrectly?

    • Matthew Woodward
      April 6th, 2015 at 9:22 am

      You can use the Google Analytics Debugger Chrome extension to see why its not working

      • emily
        April 8th, 2015 at 1:45 am

        Thank You Matthew Woodward.

  48. Sumita

    Hi Matthew,

    I have a question. i dont understand why after every code u had wrote “1.00,true” what does it mean???

    i want to track E Mailer. So how can i track that.

    onClick=”_gaq.push([‘_trackEvent’, ‘Emailler’, ‘click’, ‘BANNERNAME/url’);”

    onClick=”_gaq.push([‘_trackEvent’, ‘Emailler’, ‘click’, ‘BANNERNAME/url’,1.00,true);”

    • Matthew Woodward
      April 9th, 2015 at 5:15 am

      That sets the value of the event

  49. Ben

    Hi Matthew,
    I went through a load of my articles and added the Event tracking code, then went back in to see WordPress had stripped the onclick stuff out.

    How do you stop WordPress stripping it out and leaving it alone?

    Many thanks

    • Matthew Woodward
      June 4th, 2015 at 2:29 pm

      I guess you use the visual editor? I never touch it

      • Bianca Oldenbeuving
        July 30th, 2015 at 2:21 pm

        I was trying to find out why the code wasn’t working (or at least I wasn’t getting any results in GA). When I read the question above, I went to check, and yes: the code got filtered out, somehow! Any idea how to get the code in, without losing it?

  50. krishna

    Hi Matthew,

    I am trying to setup google analytics for one website, that displays different products(like TV, laptops, tablets..) from different wesites(amazon, flipkart..), If we select the product it will redirect to that website.

    I want to track the visit of the websites and products. Can you help me out how to track?

    Many Thanks in Advance,

    • Matthew Woodward
      July 6th, 2015 at 9:16 am

      You need onclick tracking on the button that takes them from your site to the other sites

      • krishna
        July 6th, 2015 at 1:19 pm

        Thank You Matthew for the prompt reply.

        Do you have any videos for ‘onclick tracking’ and how to setup?

        Actually we are dynamically binding the products, so are we able to apply this onClick tracking for this?

        Many Thanks in Advance,

        • krishna
          July 6th, 2015 at 1:25 pm


          We are writing entire website code in HTML and JavaScript.


        • Matthew Woodward
          July 6th, 2015 at 4:45 pm

          I am not a developer sorry

          • krishna
            July 7th, 2015 at 8:30 pm

            Thanks for the reply Matthew.

            Is it required to create goals after creating events?


          • Matthew Woodward
            July 8th, 2015 at 10:40 am

            If you want to track events as goals, yes

  51. Gareth Bull

    Superb, just applied this to a couple of my ecommerce sites, thanks Matt!

    • Matthew Woodward
      July 13th, 2015 at 2:48 pm

      No problemo :)

  52. Rik399


    New to GA…

    Is it me or do the following look the same?

    Now we just need to add it to our usual affiliate link that looks like this-


    Which ends up looking like this-


    • Matthew Woodward
      July 16th, 2015 at 10:09 am

      I’m not sure what you mean

  53. Krishna


    I have applied event tracking to ecommerce website, thank you.

    I have one requirement like, I want to create a user and give access to view only particular event category.

    Example: I want to create ‘testUser’, this user have access to view only ‘amazon’ events not other event category. And we want to give these user details to ‘amazon’, so that it will be clear to amazon that our website is navigated the urls. Is this is way to send the reports to amazon.

    Please guide me.

    Thanks in Advance,

    • Matthew Woodward
      July 27th, 2015 at 11:43 am

      You would need to build something that uses the Google Analytics API to do that

      • Krishna
        July 28th, 2015 at 12:03 pm

        Could you please share some examples…


  54. solanki kajal

    Hi Matthew,

    wow! this is an incredible post ,this will help to learn a lot about how to track anything with google analytics. Thank you for putting all these at one place for easy reference.

    Thank You

    Best Regards

    • Matthew Woodward
      August 14th, 2015 at 8:43 am

      No problem :)

  55. John

    Hi Matthew,

    Looks like the download link after liking it on facebook isn’t working, error below.

    404. That’s an error.

    The requested URL /get/analytics/web/template?uid=rxVEopOSQayvcQ6gp6ZmyQ was not found on this server. That’s all we know.

    • Matthew Woodward
      October 1st, 2015 at 3:34 pm

      Sorry fixed that up :)

  56. Barry


    I tried getting the report after sharing on google+ and when I clicked on the link it didn’t work. Please let me know.

    Also do you know how to track on Facebook using google analytics?


    • Matthew Woodward
      October 1st, 2015 at 3:32 pm

      Ooops sorry about that I have updated the link

      What do you want to track with Facebook?

  57. Vishal Shah

    Hi Matthew, Nicely explained into the video, but I have doubt, what exact values I should put if I want to track videos on my blogs, and If I have videos on multiple pages I should set up all individually or it could set up once? Please advice.

    • Matthew Woodward
      October 19th, 2015 at 9:59 am

      You dont have to put a value

  58. Dawn


    Can I track in Google Analytics my affiliates’ opt ins? I see that we can track affiliate clicks but how about for affiliate opt ins?

    • Matthew Woodward
      October 19th, 2015 at 9:57 am

      Can you explain a little more?

      • Dawn
        October 19th, 2015 at 10:19 am

        We have a launch coming up. And we’re planning to give out prizes to our affiliate partners in a contest for opt ins, not only on sales. We have ClickBank but they can only track sales. We’re finding ways on how to track opt ins for our affiliate partners and wondering if we can track opt ins through Google Analytics. I can see from the video that we can track affiliate clicks but can we track visitors who opt in from their referral links?

        • Matthew Woodward
          October 19th, 2015 at 10:29 am

          Yes if your affiliate links had Google Analytics campaign tracking tagged on the URLs

          • Dawn
            October 19th, 2015 at 10:34 am

            Thank you! Just wondering, do you have a tutorial on how to do this? Sorry, it’s crazy busy over here. I hope you can help me out :)

          • Matthew Woodward
            October 19th, 2015 at 10:34 am

            Google ‘Google Analytics Campaign Tracking’

  59. Ken

    This is only for the older analytics and not Universal Analytics. Is that right?

    • Matthew Woodward
      October 22nd, 2015 at 4:59 pm

      Yes this video is the older one I will update it for universal in due course

  60. Nas

    How do u put onclick on a embeded youtube video. Do u have an example

    • Matthew Woodward
      December 2nd, 2015 at 4:34 pm

      You will have to check out their developer documentation

  61. Charles

    I am still new to this and learning about setting up Google Analytics. Was wondering if you can direct me to any posts or videos for beginners you may have, where I can learn about Analytics and its setup?

  62. David

    It is the same Mathew.
    Now we just need to add it to our usual affiliate link that looks like this-
    Which ends up looking like this-

    Although i can read the correct example in your youtube video :)
    just want to let you know :D

    • Matthew Woodward
      March 31st, 2016 at 11:59 am

      I think the WP comment system is stripping out your code =\

      • David
        March 31st, 2016 at 12:04 pm

        you can see here: http://prntscr.com/amhrj4

        • Matthew Woodward
          March 31st, 2016 at 6:45 pm

          It looks the same?

          • just helping
            September 2nd, 2016 at 8:58 am

            looks the same for me as well the google code is lost

  63. khalifa

    thanks for this great article
    i have quick question pleas
    i have a blog that promote many amazon products , how can track which the most page or a link that drive me the most sales in amazon affiliate ? is there any way to set goals in GA to see the best page or link on GA ?
    thanks again for this article

    • Matthew Woodward
      May 5th, 2016 at 10:24 am

      I don’t know if its possible on a page level with Amazon without creating seperate tracking ID’s manually

  64. Sumit Kumar


    Can I track banner event click to conversion in google analytics ? Actually I have places banner click event code in my website for some banners and now I just want to track the total number of successful order people did after clicking that particular banner. It will be a great help if you can tell me the processor of doing that.


    • Matthew Woodward
      June 13th, 2016 at 9:56 am

      For that you would need to use Google Analytics Ecommerce tracking as well

  65. Joshua Zong

    HI Matt,

    As a suggestion (not sure if it was mentioned above when I skimmed the comments), you may want to look into working with Google TagManager to set up the link tracking. I have found it can help streamline a lot of work in the long run. I use a combination of Analytics, TagManager, and Webmaster tools for much of my work alongside XML-Sitemaps and the usual browser developer tools. Definitely useful for Analysis and SEO.

    Anyways, Cheers! (and thanks for the posts)

  66. Abuzar Ghaffari

    Great Matt….
    This very excited and very helpful for me particularly…..

    • Matthew Woodward
      September 1st, 2016 at 3:07 pm

      No problem Abuzzar!

  67. Kwasi Enoch

    Great, I’ve learned so much from this blog post and it’s amazing.

    • Matthew Woodward
      December 31st, 2016 at 2:08 pm

      I hope it helps you to grow :)

  68. Khushboo Somani

    Thanks for sharing this technique. Actually, I am really finding great techniques in using Google Analytics. I want to experience more the benefits of this tracking tool aside from traffic tracking.

    • Matthew Woodward
      February 25th, 2017 at 7:15 am

      Well there are a ton of awesome Google Analytics hacks out there!

  69. Ollie Farese

    Excellent information again. I am looking forward for more updates.

    • Matthew Woodward
      August 27th, 2018 at 10:20 am

      Cheers Ollie

What are your thoughts?


* Name, Email, Comment are Required