Truemag

  • Categories
    • Tips And Tricks
    • Internet
    • PHP
    • Javascript
    • CSharp
    • SQL Server
    • Linux
  • Lastest Videos
  • Our Demos
  • About
  • Contact
  • Home
  • Write With Us
  • Job Request
Home Tips And Tricks How To Tracking Click Event With Google Analytics

How To Tracking Click Event With Google Analytics

As you know, Google Analytics is the most popular website analytics which let you see and analyze your website traffic include Visitors, Traffic Sources, PageViews, etc. In addition, it also allows you to set up Event Tracking. For example, you want to track how many time your download button/link is clicked or your play button is pressed or even track how many percent a particular video is played by with a call out function from your player script.

Before we continue, please make sure you placed Google Tracking Code on somewhere your website (before the </body> tag). To track a particular event, you can use either of following methods:

To make it simple, I will create a click with an event tracking when click on that link.

1. Event Tracking with _trackEvent

<a href="javascript:void(0);" onClick="_gaq.push(['_trackEvent', 'Downloads', 'Click', 'Test Download Tracking']);">Click here to raise a track</a>

<a href="javascript:void(0);" onClick="_gaq.push(['_trackEvent', 'Downloads', 'Click', 'Test Download Tracking']);">Click here to raise a track</a>

The html code will render something like this:

Click here to raise a track

Assume that you’re browsing the page on Firefox with Firebug plugin installed. When click on the link above, the onClick event will call the _gaq.push function to track.

Firebug Google Analytics _trackEvent

Firebug Google Analytics _trackEvent

How the report looks like, let’s open the Google Analytics, from your Website Dashboard page, click on Content tab on the left then click on Event Tracking tab.

Google Analytics Event Tracking

Google Analytics Event Tracking

As you see on the image above, all event tracking is counted. That’s awesome.

Read more: go to Event Tracking Guide on Google

2. Page Tracking with _trackPageview

<a href="javascript:void(0);" onClick="_gaq.push(['_trackPageview', 'download_source_code']);">Click here to download the source code</a>

<a href="javascript:void(0);" onClick="_gaq.push(['_trackPageview', 'download_source_code']);">Click here to download the source code</a>

The html code will render something like this:

Click here to download the source code

When click on the link above, it will track and count for download_source_code as a page content. Let’s check how Firebug displays:

Firebug Google Analytics _trackPageView

Firebug Google Analytics _trackPageView

To see how many time the download_source_code was “viewed”, open the Google Analytics then go to Content => Top Content => type the tracking named ‘download_source_code‘ on the Filter Page text box => Go

Google Analytics Top Content

Google Analytics Top Content

Feel free to let us know how you go with it.

Apr 20, 2011Hoan Huynh
Export/Import Data From Local Database To Remote Database With MS SQL Server 2008How To Hide Affiliate And External Links On Wordpress Blog
You Might Also Like:
  • How To Track Website With Multiple Google Analytisc Accounts
  • How To Add User To Your Google Analytics Report
  • How To Export Google Analytics Report To PDF Or XML
  • Export Google Analytics Report To PDF In New Version
  • How To Send Google Analytics Report To Emails
  • Monitor Real Time Visitors, Viewing Pages And Traffic Sources In Google Analytics
  • PHP Google Analytics API Examples
  • PHP open source google analytics competitor
  • Install Firebug On Google Chrome
  • The date of 4rapiddev launching
Hoan Huynh

Hoan Huynh is the founder and head of 4rapiddev.com. Reach him at [email protected]

11 years ago Tips And Tricks_trackEvent, _trackPageview, Firebug, Firefox, Google Analytics, onClick213
0
GooglePlus
0
Facebook
0
Twitter
0
Digg
0
Delicious
0
Stumbleupon
0
Linkedin
0
Pinterest
Most Viewed
PHP Download Image Or File From URL
24,554 views
Notepad Plus Plus Compare Plugin
How To Install Compare Text Plugin In Notepad Plus Plus
21,892 views
Microsoft SQL Server 2008 Attach Remove Log
Delete, Shrink, Eliminate Transaction Log .LDF File
17,745 views
JQuery Allow only numeric characters or only alphabet characters in textbox
15,069 views
C# Read Json From URL And Parse/Deserialize Json
11,802 views
4 Rapid Development is a central page that is targeted at newbie and professional programmers, database administrators, system admin, web masters and bloggers.
Recent Posts
  • Things to Learn about Installingderm Loan Type S
  • Online Photo Editor – Free Photoediting Software
  • A Guide to Finding the Best Paper Sellers
  • Photoediting in Home Isn’t Hard to Do!

  • Free Photo Editor Online
Categories
  • CSharp (45)
  • Facebook Graph API (19)
  • Google API (7)
  • Internet (87)
  • iPhone XCode (8)
  • Javascript (35)
  • Linux (27)
  • MySQL (16)
  • PHP (84)
  • Problem Issue Error (29)
  • Resources (32)
  • SQL Server (25)
  • Timeline (5)
  • Tips And Tricks (141)
  • Uncategorized (647)
Recommended
  • Custom Software Development Company
  • Online Useful Tools
  • Premium Themes
  • VPS
2014 © 4 Rapid Development