AdWords Conversion Tracking via Google Analytics goals

Posted on: 2014-11-03 | Categories: Google

Adwords-logoPeople usually use AdWords Conversion Tracking code that they place on the specific page they would like to measure. For example to measure successfully registration they will place AdWords Conversion Tracking code on the “Thank You for registration” page (some time ago it was the only way to receive AdWords conversions data). That’s quite good solution but sometimes it just isn’t enough… What about single page application? What about some extra metrics that can help to optimize your campaigns?

Instead of using standard Google Adwords conversion tracking API, we recommend to use powerful Google Analytics Events feature for AdWords Conversion Tracking.

Note: In this example i’m using Universal Google Analytics API. More information can be found here and here.

Google Analytics goals

If you dont’t know yet what Google Analytics Goals are and why they are so important for you website – this is a must-watch video (great overview on why and how to use GA goals):

Events as Goals: Remember to setup proper events for your Google Analytics Goals so that our registered events can become goals and can be later used for conversion tracking in Google Analytics and Google Adwords.

AdWords conversion tracking with Google Analytics events

Goals collected in Google Analytics can be easily imported to Google Adwords panel. But to do that we need to set up both: Google Analytics and Google Adwords accounts first (if you haven’t done it yet):

After setup, you will be able to import Google Analytics Goals (if any are available) into Google Adwords Conversions panel. Go to AdWords -> Tools -> Conversions and click Import from Google Analytics button (you can also choose which goals to import):


Imported goals will be listed below with proper data.

Notice: If you want to track new events in Google Adwords, you will need to create proper goal in Google Analytics first.

How to track custom events via Google Analytics

Having configured Google Analytics and Google AdWords, we can now start tracking (collecting) our events. Tracking events is as simple as executing proper JavaScript code for given action, e.g. clicking some button, displaying “Thank you for registraion” page or performing certain tasks on page.

Important: To be able to use ga object it needs to be initialized first as below:

This code should be executed just after proper action (event) takes place. Let’s imagine a scenario where we want to register simple “Customer Registration” event just after completed registration without refreshing page and without extra “Thank you for registration” page. With jQuery code should look like this:

Server-side tracking API: Measurement Protocol

Events can also be registered on the server side using official server-side tracking API: Measurement Protocol, which allows developers to make HTTP requests to send raw user interaction data directly to Google Analytics servers. This is the missing GA component that allows us to send different types of request:

  • Page Tracking
  • Event Tracking
  • Ecommerce Tracking
  • Social Interactions
  • Exception Tracking
  • User Timing Tracking
  • App Tracking

For more information there is great Developer guide.

To register custom event from server side with simple PHP class it’s just a few lines of code:

Important: In this example i’ve used very simple PHP implementation of GA class (there are also many different well documented and tested PHP libraries in Github for Measurement Protocol Client).

Registering events on the server side is really useful for example when we want to register / track some transactions which are processed by CRON scripts or any other action that cannot be executed in the browser. In this way we can also register some Google Analytics ecommerce transactions or social interactions.