The Measurement Protocol is one of Google Analytic’s many useful features that extends the capabilities of the platform. The feature allows developers to execute HTTP requests from external environments using the protocol to build and send hits to GA’s servers.
Diagram courtesy of GoogleAs you can see in the diagram above, via the Measurement Protocol you can send external data, from an offline environment for example, to GA which can then be combined with the online data. I’ve been working on a couple of integrations of this manner and along the way through a lot of troubleshooting, came to some best practices that make the implementation of such integrations better.
In this article, I will share a few tips and tricks about the Measurement Protocol’s implementation which hopefully will help you save time troubleshooting and testing issues.
Here is the TL;DR version, with the expanded content after:
1. Mark all offline hits – cdX=true
, where cdX is a session-scoped custom dimension “Offline Session”
2. Session control – sc=end
, force offline sessions to end with the offline hit
3. Custom Metrics – set them as hit-scoped
4. Views Setup – have a separate Offline View with “Exclude hits from known bots” turned OFF
1. Mark all offline hits
Always use cdX=true
as part of all offline hits sent to GA. In this case, “cdX” is a session-scoped custom dimension named “Offline Session” and “X” is the index of the dimension you created. By attaching this custom dimension to all offline hits you are :
1. Having a parameter to use for filters and Custom Channel Groupings
2. Future-proofing your setup for cases when Digital > Offline attribution analysis will be carried out for campaign optimization
Additionally, if you make sure that you are not adding a source/medium information as part of the offline hits, with the above you can also:
1. See digital and offline touchpoints (i.e. Paid Search > Organic Search > Offline Session), where the conversion will be attributed to the preceding digital traffic source in the standard last-non-direct-click reports. This is because by not specifying the source/medium of the offline hit, it is automatically set as direct/(none).
2. Session Control
Add sc=end
parameter to all offline hits. This will force the session to end with the offline hit so that you do not get cross-pollination of data. This can happen in cases where the customer actually has a web session active while their conversion is being sent from the CRM(or any other offline environment). Additionally, this allows you to set user-scoped custom dimensions without the risk of overwriting previous values in the session for hit-level accuracy.
Additionally, if you want to make sure you are not inflating the sessions count in your reports, add the parameter ni=1
to all offline hits as well. This will ensure offline hits do not trigger a new session. You will still be able to see event data, but it will not increment sessions because these events will be only “non-interaction” type of events.
3. Custom Metrics
If any custom metrics are used, it is best to set them on a hit-scope. That would ensure that sum counters work as expected.
4. Views Setup
When structuring the data in Google Analytics, it is best to have a separate view where Offline data is kept. That is mainly because of the fact that in some instances, when the “Exclude hits from know bots” option is turned ON, the offline data is also picked up and blocked. In order to keep that feature ON for your Main Reporting View, have a separate Offline View that has the feature turned OFF.
Summary
Here’s an example event hit that would be sent from an offline CRM System to GA when a user activates an account:
POST /collect HTTP/1.1 Host: https://www.google-analytics.com Payload: v=1 // Version number &t=event // Event hit type &tid= {{Property ID}} // Analytics Tracking ID &cid={{Client ID}} // Client ID &ec=offline // Event Category &ea=activation // Event Action &el={{account type}}// Event Label &ni=1 // Event non-interaction true &sc=end // End Session &cd1=true // Custom Dimension - Offline Session &cd5={{Client ID}} // Custom Dimension - Client ID
Hopefully the above will be useful to you and will save you some time on your next offline-online data integration. If there are other tips, tricks, and caveats when working with the measurement protocol that you came across, feel free to share them down in the comments section below.
Resources
Measurement Protocol Parameters
Measurement Protocol Hit Builder
Share this Post