We recently switched to Marchex for call tracking. With Marchex, we hoped to be able to attribute calls to the source, medium and even keyword.
Marchex has a Google Analytics “postback” feature which will send a pageview to Google Analytics. We can specify the URL. However, it’s not possible to send any kind of tracking data (including URL parameters), via the URL or otherwise, directly to Google Analytics. (You can include URL parameters in your URL, but they won’t do anything. Google will only receive the path.)
Initially, we tried to work around this by specifying the source and medium as part of the path (e.g. http://domain.com/source/medium/). Obviously, Google Analytics isn’t going to identify and extract the source and medium from a URL like that. And that “workaround” never really satisfied me.
Marchex has a “postback” feature that posts a ton of juicy call data. You can send this POST to any URL you want. And… you can include URL parameters.
So, that’s exactly what we did. And it works like a charm. Want to see how we did it?
First, read this post on tracking campaigns with Google Analytics measurement protocol.
Next, take a look at the data that Marchex sends via their post.
|acc||Unique Account ID|
|grp||Unique Group ID|
|cmp||Unique Campaign ID|
|call||Unique Call ID|
|called_number||Phone Number Called|
|caller_number||Phone Number Called From|
|caller_name||Name of Caller (per Caller ID info supplied)|
|call_start||Start Timestamp of call|
|call_end||End Timestamp of call|
|keyword||Keyword call was assigned to (if you have the “Keyword-Level Tracking” package)|
|recorded_p||Was the Call Recorded|
|call_status||Call Status (ANSWER, HANGUP, VOICEMAIL, or OTHER)|
|assigned_to||User call assigned to|
|answer_offset||Seconds of Playfile and Ringing|
|ring_duration||Seconds of Ringing|
|lookup_name||Caller name from Reverse Lookup|
|lookup_address||Caller address from Reverse Lookup|
|lookup_city||Caller city from Reverse Lookup|
|lookup_state||Caller state from Reverse Lookup|
|lookup_zip||Caller zip from Reverse Lookup|
You could potentially grab any or all of this data and send it to Google Analytics using custom dimensions and metrics.*
Suppose you wanted to track the city from which the call came. You could create a custom dimension for “city.” If you were doing this in PHP, you’d simply do something like
<?php $data['cm1'] = $_POST['lookup_city']; ?>
Alternatively, although I haven’t tried this, it might be possible to spoof an IP address from the caller’s city, state and zip. The way I imagine this would work is by having a database of IP ranges for U.S. cities, states and zipcodes. Then you’d attempt to send the IP address through the cURL HTTP header option like this:
<? curl_setopt( $ch, CURLOPT_HTTPHEADER, array("REMOTE_ADDR: $ip", "HTTP_X_FORWARDED_FOR: $ip")); ?>
Finally, as I mentioned earlier, in Marchex’s system, where you set the URL to which you’d like them to post all this juicy call data, you can also include URL parameters. This means that you can also identify the source and medium (if you’ve created a Marchex ad campaigns for specific sources/media). Here’s an example of how a Marchex “Postback URL” might look.
Once you’ve done all that, all that remains is to send phone calls and check out all the cool data in Universal Analytics property you’ve set up in Google Analytics.