Follow Point It on Social Networks

Point It on Facebook

Point It on Twitter twitter / pointitinc

How to track button clicks with Google Analytics

We’ve all seen websites with hotel reservations, affiliate marketing, and webinar signups where in order to make a purchase or become a lead, a visitor needs to go to a third-party page. Well, I have worked with a few like that and in every case tracking is the first thing that needs to be addressed. After all, if we do not know how many people completed the CTA, how could we claim that the campaign is a success?

This kind of tracking has an undeserved reputation of being difficult to implement. But in reality, all you need is Google Analytics code on your site and a little bit (honestly!) of coding.

But before you get started, do yourself a favor and check the following:

1. Make sure you are using the newer version of GA on your site. The on-page script I am using will not work with old Urchin code.

2. If your site is in PHP, GA’s new code may have a syntax conflict. This does not mean you can’t use the new code. It just means that you need to modify it to be

<script src=”http://www.google-analytics.com/ga.jstype=”text/javascript“>
</script>
<script type=”text/javascript“>
var pageTracker = _gat._getTracker(”UA-XXXXXXX-X”);
pageTracker._trackPageview();
</script>

3. Make sure you have access to your website and can make code changes (DUH!).

Now, you are ready to get started.

Step 1. Set up the goal.

Let’s say, the goal is to track when a user clicks on your RSS subscribe button. Note: when they click on the button, there’s no guarantee that they’ll actually subscribe. Let’s also assume that at www.example.com we have just one type of subscription and it is a big RSS button in the upper right.

1. GA Settings Page is your first stop. Click “Edit” for www.example.com.

GA Tracking Goal Setup

  • From the Conversion Goals and Funnel table, click “Edit” next to one of the not configured Goals.
  • Now, set the URL of the goal to be a non-existent page. For example: http://www.example.com/goal/example.
  • Name your goal something like “RSS subscription”.
  • Use head match as your match type.
  • Done

Step 2. Tracking the clicks on the RSS button.

This is the part where you will be coding (just a little bit) and adding a javascript to track the onclick event on the RSS button. To track the button clicks, we need GA to register a “visit” to the fake page we created (http://www.example.com/goal/example).

Now, we need to add the on-click tracking code to the RSS button. This is the code to use:

<a href=”/goal/example” onclick=”javascript:pageTracker._trackPageview (’example’);”target=”blank”>

Step 3. Looking at your data.

Note: it may take time for the data to show so do not get discouraged if you are not seeing it within the first 72 hours.

You should see your RSS button clicks as a goal you set up:

GA Goal: RSS Subscription
Enjoy!

One Response
  1. Frank

    Date: March 26, 2010

    This is great info.

    Many marketers are not aware that button clicks can be tracked so this will help many of them.

Leave a Comment

Your comment

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.