analytics-600

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:
Screen Shot 2015-06-30 at 3.06.13 pm

 

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 –

conversion tacking

To track clicks on a particular “<a href= ” link, add a unique id to the tag :

for example

Screen Shot 2015-07-02 at 5.40.58 pm

Use the unique id name in your script below:

Screen Shot 2015-07-02 at 5.39.54 pm

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.

Screen Shot 2015-07-02 at 5.38.20 pm

Screen Shot 2015-07-02 at 5.41.33 pm