Cardinal Path’s response to COVID-19 Cardinal Path is sharing all we know to help marketers during COVID-19.  Learn more.

The consulting and engineering teams at E-Nor continue to take advantage of Measurement Protocol to meet a range of tracking needs that our clients bring to us. We also continue to discuss critical Measurement Protocol concepts on our blog so you can get closer to a universal understanding of user engagement, even when the tracking context presents specific challenges, such as limited connectivity for mobile app users (think cruise ship…).

Validate Measurement Protocol Hits Using Google oauth Playground

You may have already had the chance to reference our Measurement Protocol Parameter Reference for required and optional parameters in a Measurement Protocol hit, but how can you actually verify that your Measurement Protocol hits are well-formed as you’re writing them into your coding logic?

Use the Google OAuth 2.0 Playground to validate any HTTP request, including the measurement protocol hits. Google OAuth Playground will validate if the hit is valid or not. A hit is valid if:

  • it has the minimum number of parameters.
  • all parameters are included in the right format.

Very easy to use, the Google OAuth Playground confirms and reports all the needed information about the hit, including extra details that could be helpful for developers, including request headers and get or post request method.

To validate a Measurement Protocol hit using Google OAuth Playground:

  1. Open Google OAuth 2.0 Playground.
  2. Choose the API you want to use (Google Analytics in our case) and click Authorize APIs.
  3. Ignore step #2 and move directly to step #3 (Configure request to API).
  4. In the Request URI field, add this sample hit and send the request:
    https://www.google-analytics.com//debug/collect?v=1&t=event&tid=XX-XXXXXXX-X&cid=5555&ds=crm&z=123456&ec=OffSiteTransaction&ea=CRM&el=TransactionSuccess&ev=100&qt=560&cd1=126555C-1715551RTest&cd7=CreditCard&cd8=Platinum&cd9=100&ti=1234-1234&tr=100.00&pa=purchase&pr1id=standard-current-account&pr1nm=standard-current-account&pr1ca=foreign-exchange&pr1ps=100.0&pr1qt=1
    The response will indicate that the request was not valid.

We forgot to specify a valid tid parameter, that is, a Google Analytics property ID. Let’s try again with a valid tid parameter:

https://www.google-analytics.com//debug/collect?v=1&t=event&tid=UA-114688059-1&cid=5555&ds=crm&z=123456&ec=OffSiteTransaction&ea=CRM&el=TransactionSuccess&ev=100&qt=560&cd1=126555C-1715551RTest&cd7=CreditCard&cd8=Platinum&cd9=100&ti=1234-1234&tr=100.00&pa=purchase&pr1id=standard-current-account&pr1nm=standard-current-account&pr1ca=foreign-exchange&pr1ps=100.0&pr1qt=1
The response now indicates that our Measurement Protocol request was good.

Verifying and Filtering Measurement Protocol Data in the Google Analytics View

You may still want to verify directly in Google Analytics that your Measurement Protocol data has been recorded. In a Google Analytics property that is recording data through Measurement Protocol and other mechanisms (such as gtag.js), you’ll need to use filters and segments to isolate your Measurement Protocol data.

If you populate the ds parameter in your Measurement Protocol hit, you can segment or filter based on the Data Source dimension:

Using the Data Source dimension to segment Measurement Protocol data in a Google Analytics views
If you don’t send the ds parameter with your Measurement Protocol hit, you can filter and segment based on any unique parameter or custom dimension that you do send.

Queue Time Parameter for More Accurate Offline Interaction Timestamping

Another of our previous blog posts considered Integrating the User Journey with Google Analytics: Three Offline Business Cases. What about a tracking scenario that is offline in the sense that the user is interacting with a mobile app on a device that may be suffering from spotty internet access?

Queue Time (qt) is an optional parameter, but it can be really useful for the purposes of:

  • recording hits with the time at which they actually occurred if the sending of the hit has to be delayed.
  • ordering hits.
Queue Time: Record a Measurement Protocol Hit with the Time of Interaction Rather than the Time of Hit Send

The fundamental functionality and benefit of queue time is that it allows you to send a hit to Google Analytics later than the corresponding action but still report that action with the time that it occurred.

Queue Time can be critical for reliable tracking in that mobile app scenario (if you’re using Measurement Protocol to track a non-iOS or non-Android mobile app, for example). As a few specific considerations for queue time:

  • You provide the time delta in milliseconds.
  • The value must be greater than or equal to 0.
  • Values greater than four hours may lead to hits not being processed. This is the most important point, as you could lose a significant amount of data if you set the queue time for more than four hours.

Also, using the Google Analytics batch (https://www.google-analytics.com/batch) endpoint, instead of the collect (https://www.google-analytics.com/collect) endpoint, in addition to the Queue Time parameter, will give more control over the sending order because you can send up to 20 hits at a time per batch request with 16k bytes as maximum payload.

Ships Ahoy

One challenge that the E-Nor engineering team faced was tracking user interaction with an app that was likely to be used aboard ships.

Measurement Protocol with Apps for Android, iOS, and Operating Systems

In the case of an app developed for a non-Android and non-iOS operating systems, such as Microsoft or Blackberry mobile devices, you need to use Measurement Protocol for Google Analytics tracking. In the case of the iOS or Android version of the app, the Firebase SDK can usually take care of all underlying logic for sending hits with the optimal parameters; however, you may still want to use Measurement Protocol for Android or iOS if there is a possibility of losing the connectivity for more than 28 hours (24 hr/day +4 hours latency). Using the SDK, data must be dispatched and received by 4 AM of the following day, in the local time zone of each Google Analytics view (profile). Any data received later than that will not appear in reports. With Measurement Protocol, you can send data whenever connectivity is restored. Because the maximum queue time is four hours, the timestamps in the data may not reflect the actual time of user interaction, but at least the data will be recorded.

The tracking steps included:

  1. Check for connectivity.
  2. If connectivity is good, send a Measurement Protocol hit without the queue time parameter.
  3. If connectivity is not good, store the user interaction locally (as XML, or with any suitable persistence mechanism), making sure to save the timestamp at which the interaction actually occurred.
  4. Recheck for connectivity at regular intervals.
  5. If connectivity is good, send a Measurement Protocol hit with the qt parameter representing the difference in milliseconds between the time the timestamp of the user interaction and the time the hit is sent.

For instance, the Measurement Protocol hit below would record a user interaction as having occurred 88 minutes – or 5,280,000 milliseconds – before the time of good connectivity at which the hit is sent:

https://www.google-analytics.com//debug/collect?v=1&t=event&tid=UA-100119909-1&cid=5555&ds=crm&z=123456&ec=OffSiteTransaction&ea=CRM&el=TransactionSuccess&ev=100&qt=5280000&cd1=126555C-1715551RTest&cd7=CreditCard&cd8=Platinum&cd9=100&ti=1234-1234&tr=100.00&pa=purchase&pr1id=standard-current-account&pr1nm=standard-current-account&pr1ca=foreign-exchange&pr1ps=100.0&pr1qt=1
What if the user is offline for more than four hours?

The maximum value that you can specify for the queue time parameter is four hours, or 14,400,000 milliseconds. If your users are on the high seas with no connectivity for several days, you can code your own logic to send the Measurement Protocol hit whenever connectivity is restored, but you can’t set qt to more than 14,400,000, or you risk dropping the hit. Abiding by the four-hour rule, you may have user interactions reported as occurring later than they actually did, but, importantly, you’ll still know that they did occur.

Have questions about measurement strategy? Contact us today.

Sharing is caring!

Popular

COVID-19 Crisis Navigator​

In partnership with Dentsu, Cardinal Path helps you distill the overwhelming news and information into a bi-weekly report highlighting emerging trends and insights during the pandemic.

EXPLORE THE REPORT

Analytics Rising Logo

FREE VIRTUAL EVENT

October 14

Practical Strategies Delivered By Top Minds in Digital Marketing

Register for #AnalyticsRising and get a Starbucks Gift Card when you share the news.

Message Sent

Thank you.

Click here to download access the tool.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you.

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Thank you

Message Sent

Thank you.

Message Sent

Success!
Your message was received.

Thank you.

Message Sent

Thank you for registering.

Thank you for submitting the form.

Thank you for your submission.

Thank you for your submission.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for your submission.

Message Sent

Thank you for registering.

Thank you for registering.​

Paid media spend by Government websites increased a whopping 139% YoY in 2020.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

2020 Online Behavior Live Dashboard

Message Sent

Thank you for registering.

Thank you for submitting the form.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Message Sent

Thank you for your submission.

Message Sent

Thank you for registering.

Message Sent

Thank you for registering.

Thank you for registering.

Cardinal Path is continuing with its series of free training. Next we are conducting training on Google Data Studio. Check it out here.
Cardinal Path hosted a live session to connect with you and answer all your questions on Google Analytics.
Get all the expertise and none of the consultancy fees in this not-to-be-missed, rapid-fire virtual event.

Message Sent

Success! Thank you
for reaching out.