Tracking Phone Orders in Google Analytics with Proper Attribution

Plenty of businesses have some version of the following problem. Most or all of their customers originate online. Some big chunk of sales happen offline. This is most common with high dollar purchases or B2B transactions. For a lot of folks, this revenue is a mystery. It doesn’t need to be.

There’s a lot of solutions out there for this, they’re all variations of the same theme. When someone gets to the site and calls you (or chats or whatever brings in an offline step), you need to find a way to get their traffic source so it can go into your CRM or order management system. Then you either need to combine that sales data with your web analytics to get a full picture or (ideally) find a way to get that data into your web analytics platform.

Here’s one way of doing that. This is more geared toward smaller companies and is something you can accomplish without a lot of development work. Also, this is specific to Google Analytics.

Step 1 – Grab the visitor info.

When Google switched to Universal Analytics, a lot of folks were annoyed because it was no longer a matter of just grabbing traffic source info from visitor cookies to send to your other analytics tools. But we can still get the info we need for the sake of further interaction with GA. We need what’s called the Client ID (CID). It’s the unique identifier that ties a person to all of their visitor info on Google’s servers.

In this example, I use two scripts in Google Tag Manager to get this info. The first grabs the CID from GA so it’s available to do stuff with. I’m pushing it to the dataLayer so we can further work with it in GTM.

This should fire on all pages:

  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', '{{GA ID}}', 'auto', {'allowLinker' : 'true'});  
  ga(function(tracker) {
      window.dataLayer.push({
          'event' : 'trackerReady',
          'cid' : tracker.get('clientId')
      });
  });

The next piece of it is really a matter of preference, but in my case all of this would work the best if the CID were added as a query string in the URL. This is how we accomplish that.

var separator = (window.location.href.indexOf("?")===-1)?"?":"&";  
var pageUrl = window.location.href + separator + 'cid={{CID}}';
window.history.pushState('','',pageUrl);

Obviously make sure your first script can run before this happens or you’ll get a lot of null values.

Step 2 – Call Tracking

This is pretty straightforward. My client is using CallRail. There aren’t a ton of options out there, but this is a good one IMO. Most/all of these call tracking platforms have some sort of GA integration that creates events/goals when calls happen. But in our case, the key is that they also display the URL(s) a person visited before calling. This includes our CID query string.

What happens here is the phone rep enters the order as they always would. The extra step is using the CallRail dashboard to copy/paste the CID into a custom field we had added to their order management system. From there we just have to get the data back to GA.

Step 3 – Sending to GA

Google Analytics has a system for sending hit data to GA called the Measurement Protocol. This is where your developer comes in.

Essentially what needs to happen is that as the order is processed offline, a GET or POST request happens that sends data to GA via the Measurement Protocol. Here’s an example of how those requests are built – if you’re familiar with the basics of GA’s ecommerce tracking, this is largely going to look familiar.

 

Transaction Hit Request

 

Parameter Value Type Example/Value Notes
v constant 1 Always 1
t constant transaction Indicates we are sending transaction data
tid constant UA-1234567-8 Analytics property ID
cid variable 1234567890.0987654321 CID collected with form submission
cd3 Variable – text 5555 Customer ID # (assigned by Blue Soda Promo)
ti variable – Text 1234 Order ID #
ta variable – text Phone Transaction affiliation. Optional value, but can indicate how the order was placed (e.g. phone, chat, email)
tr Variable – currency 105.17 Total order revenue including shipping and tax
ts Variable – currency 9.95 Shipping cost from order
tt Variable – currency 5.23 Tax cost from order

 

Item Hit Request

 

Parameter Value Type Example/Value Notes
v constant 1 Always 1
t constant item Indicates we are sending item data
tid constant UA-1234567-8 Analytics property ID
cid variable 1234567890.0987654321 CID collected with form submission
cd3 Variable – text 5555 Customer ID # (assigned by Magento
ti variable – Text 1245 Order ID #
in variable – text Transistor Brand Running Shoes – Green Name of product
ip Variable – currency 89.99 Price of item
iq Variable – integer 1 Quantity of item
ic Variable – Text 123456 SKU of item (use variant SKU to indicate color/size/etc)
iv Variable – Text Running Shoes Optional – Category of Item

You can check your work by using Google’s Hit Validator.

That’s it! There’s some data that won’t be perfect using this method – e.g. geographic information will generally show the location of your server for phone orders. But traffic sources will reflect your actual marketing campaigns and you’ll have a full picture of revenue. Most anomalies in tracking can be resolved by applying an attribution model. In the case of this client, about 60% of their revenue happened over the phone but it all originated from the web. That’s a huge difference in numbers and our ability to judge performance.

Happy tracking!

Leave a reply

Your email address will not be published. Required fields are marked *