How to Send Call and Campaign Data from Marchex to Google Analytics

 
 
06/27/2013
 
 
 

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.

But wait!

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.

It occurred to me… I could write a script that will receive the Marchex POST and then send the data to Google Analytics using the new Universal Analytics and the measurement protocol!

Duh!

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.

Argument Description
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)
forward_no Forwarding Number
assigned_to User call assigned to
answer_offset Seconds of Playfile and Ringing
ring_duration Seconds of Ringing
inbound_ext Inbound Extension
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.

http://targetclickmarketing.com/mp?ga_acc_id=UA-98765432-1&domain=whatever.com&path=%2Fphonecall&page_title=Phone%20Call&utm_source=google&utm_medium=cpc

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.

* FYI: It’s against Google’s Terms of Use policy to import personally identifying information. So, don’t go sending things like the caller’s name, address, phone number, etc. to Google Analytics. That could land you in hot water with Google.

The following two tabs change content below.

Dave Meindl

Dave Meindl has been doing online marketing stuff since 2004. Stuff he's done or is doing: PPC advertising, SEO, affiliate marketing, email marketing, AdSense, lead generation, conversion optimization, blah blah blah. And so on. He co-founded the search marketing agency Posicionamiento Profesional, S.L. (Spain). He was the PPC and SEO strategist for the ecommerce company Clickstop, Inc. And now he helps TargetClick improve their search marketing systems.
 

Posted in: Analytics, Google

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 
 

Contact Us

We want to help you find a digital marketing solution that’s perfect for your individual business.

Drop us a line to get started today!

Find Us

We are located in Building #5 of the Mudd Advertising Campus in Cedar Falls, Iowa.

915 Technology Parkway

Cedar Falls, Iowa 50613

800.655.3037

that's right, we're hiring!