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.

accUnique Account ID
grpUnique Group ID
cmpUnique Campaign ID
callUnique Call ID
called_numberPhone Number Called
caller_numberPhone Number Called From
caller_nameName of Caller (per Caller ID info supplied)
call_startStart Timestamp of call
call_endEnd Timestamp of call
keywordKeyword call was assigned to (if you have the “Keyword-Level Tracking” package)
recorded_pWas the Call Recorded
call_statusCall Status (ANSWER, HANGUP, VOICEMAIL, or OTHER)
forward_noForwarding Number
assigned_toUser call assigned to
answer_offsetSeconds of Playfile and Ringing
ring_durationSeconds of Ringing
inbound_extInbound Extension
lookup_nameCaller name from Reverse Lookup
lookup_addressCaller address from Reverse Lookup
lookup_cityCaller city from Reverse Lookup
lookup_stateCaller state from Reverse Lookup
lookup_zipCaller 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:

<?php 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.

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

Related Posts

0 Response
  1. Chris Sullivan


    Thank you for your time and effort in sharing your experience and the process you used to setup our Keyword Level Tracking product. We’re glad it worked for you and that our support was able to assist. We have been investing heavily in Call Analytics and unfortunately the documentation hasn’t kept up. We are in the process of updating our product documentation and will be releasing it in the coming months. Stay tuned. Feel free to reach out to me if I can be helpful in some way or if you have other feedback.

    Chris Sullivan
    Sr. Product Manager – Marchex Call Analytics

  2. Hey Chris, thanks for stopping by. It’s reassuring to see you actively reaching out to us. But I warn you, by extending an open invitation to me you’ve opened a big can of worms! 🙂

  3. Chris Sullivan

    Happy to help any way that I can. 🙂 We love hearing from our customers and I appreciate any feedback you have. Thanks! Chris

  4. Matt C

    Any idea why when I use “?_vsrefdom=ppc” the traffic is showing up under “Organic” Traffic in analytics? Shouldn’t this be recognized as “Paid” Traffic?

  5. Dave Meindl

    Hey Matt,

    • Where are you using the _vsrefdom parameter? Just AdWords and Bing Ads? Or elsewhere?
    • Have you double checked to make sure you’ve enabled auto tagging?
    • Have you appended the proper UTM parameters to your Bing ads?
    • Do those UTM parameters contain the correct values?
    • Are you referring to the actual traffic or are you referring to the Google Analytics Call End Postback?

Leave a Reply