If you would like to track the clicks of a phone icon, phone number, link to an external site, or any link for that matter – you can easily do that by adding a couple of lines of code to your site. This way you can even split test two different coloured buttons on the site and see which works well for you page.
If you would like to set a particular event as a goal, that can then be that event can be set up as a goal in Google Analytics.
This post will tell you how to do both.
Step 1:
Make sure you have the latest version of google analytics installed. This post will work only for the code format below:
Step 2: Set up Event tracking on your WordPress site
Log into your admin and go to Appearance -> Editor. Find the footer.php file and take a back up of it. Then add the lines below just before the closing “body” tag:
To track clicks to any external links, replace the link “example.com” with your link in the code below –
To track clicks on a particular “<a href= ” link, add a unique id to the tag :
for example
Use the unique id name in your script below:
This will start tracking these events in Google analytics!
Step 3: Goal Set up
Follow the two images to set up the Goals for the two events in Analytics. Make sure that the Goal type is Event and when you fill in the Category, Action and Label – they are all case sensitive.
Hey!
It looks like you're browsing in . Would you like to switch over to the website?