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

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. 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!


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

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:


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.

* 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.

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInEmail this to someone
The following two tabs change content below.

Dave Meindl

Project Analyst at Mudd Advertising
Dave's been doing the online marketing thing since 2004: PPC, SEO, affiliate marketing, email marketing, lead generation, conversion optimization, ecommerce and so on. Dabbles in PHP and MySQL. Loves pizza.

No Comment


Post A Comment