Skip to main content

Drupal Commerce and Google AdWords Conversion Tracking

Published on
Google AdWords provides a tracking code that allows you to keep track of how well your ads are performing - if someone clicks an ad and ends up at the conversion code, the ad was technically a success. Typically you would use this in e-commerce and track order completions. There is a Google AdWords module to allow full Drupal integration...but that seems like a lot of overhead for merely wanting to monitor customer order completion (note: I did not attempt to use the Google AdWords module.) It seemed much simpler to just create a small module which will add a pane to the checkout form, specifically the "Checkout Complete" page. This pane drops in our Google AdWords conversion code and that's it. The following code is all your need to create the module, there is no form to change the AdWords value via a form. Just edit the source code and modify the JavaScript tracking code as needed. By default it adds itself to the "Checkout Complete" page. I've provided the sample .info and .module file.