Measurement Protocol Hit Builder

Hits, Bits, and Bytes

The Measurement Protocol allows one to send data directly to Google Analytics from any device or system.  The Measurement Protocol Hit Builder lets you build, validate, and share hits which can also be sent directly from the Hit Builder.

Sending very specific data to Google Analytics through the Hit Builder is often faster than instrumenting a page with analytics code or creating a data layer & Google Tag Manager container.

Examples of data points that can be sent with the Measurement Protocol:

  1. Events
  2. Virtual pageviews
  3. Custom dimensions
  4. Custom metrics
  5. Ecommerce data
  6. Timing
  7. App screens

 

A few use cases where sending data with the Measurement Protocol makes sense:

  1. Test a new filter with a certain set of inputs
  2. Explore scopes of dimensions and metrics
  3. Show a client what a proposed solution might look like
  4. Send sensitive or competitive data directly to Google Analytics instead of surfacing it in the data layer.

 

Sending an Event

Sending a simple event is no more complicated than deciding the category, action, and label for the event:

 

 

Initially this will show as not validated:

 

 

After the hit is validated, it can be sent to GA, the payload can be copied, or a sharable link to the hit can be generated:

 

 

Sending the hit to Google Analytics will show up as a regular event in the Top Events report:

 

 

A link to this hit in the MP HIt Builder:

https://ga-dev-tools.appspot.com/hit-builder/?v=1&t=event&tid=UA-12345-1&cid=10212017.1000001&ec=ecommerce&ea=transaction&el=id%20%3D%20123456789&z=1000001

 

 

Pageviews

Pageviews can also be sent with the Measurement Protocol. Sometimes virtual pageviews or the above event example are sent from a website backend after a form submission or transaction along with sensitive ecommerce or user details that aren’t suitable to load on a website.

You could also use it to send subtle hints to your manager:

 

 

And in Google Analytics:

 

 

A link to this hit in the MP HIt Builder:

https://ga-dev-tools.appspot.com/hit-builder/?v=1&t=pageview&tid=UA-12345-1&cid=10212017.1000002&dh=analyticspros.com&dp=%2Fvp%2Fgive-everyone-raise&dt=Give%20Everyone%20a%20Raise&z=1000002

 

 

Custom Dimensions

Custom dimensions, especially when dealing with multiple scopes, can take some getting used to and the best way to understand them is to jump in with both feet.

We can add a hit-scoped custom dimension named “Page Category” to our previous hit:

 

 

And the result in GA:

 

 

Try sending different values for all four dimension scopes (hit, session, user, and product) to get a better feel for how they are processed and what you will see in reports.

 

A link to this hit in the MP HIt Builder:

https://ga-dev-tools.appspot.com/hit-builder/?v=1&t=pageview&tid=UA-12345-1&cid=10212017.1000003&dh=analyticspros.com&dp=%2Fvp%2Fgive-everyone-raise&dt=Give%20Everyone%20a%20Raise&z=1000003&cd2=for%20testing

 

 

Custom Metrics

Similar to Custom Dimensions, Custom Metrics often take some time to wrap your head around.  The additive nature of Custom Metrics makes them different from Custom Dimensions.

We can add a hit-scoped custom metric named “How Much Raise?” to our previous hit:

 

 

And the results:

 

 

Custom metrics can also be product scoped.  Try sending different values to both scopes to get a feel for how GA will interpret and display the data.

 

A link to this hit in the MP HIt Builder:

https://ga-dev-tools.appspot.com/hit-builder/?v=1&t=pageview&tid=UA-12345-1&cid=10212017.1000004&dh=analyticspros.com&dp=%2Fvp%2Fgive-everyone-raise&dt=Give%20Everyone%20a%20Raise&z=1000004&cm1=1000000

 

Things to Watch Out For

A few common mistakes:

  1. “cid” in the above screenshots refers to the Google Analytics Client ID.  It must be different for every user you want to represent data.
    1. I often use this format for consistency: MMDDYYYY.randomNumber.
    2. Example: 10212017.1000001
  2. The “z” parameter is a random number to help prevent hit caching or blocking.
    1. In test data, I usually reuse the same random number from the second half of the Client ID.
    2. Not including this, even from the Hit Builder, can cause data to be lost.
  3. The hit will generally show up in Real Time reports immediately but might take a few minutes or longer to show up in other reports.

 

Additional Resources

For your reading pleasure:

 

Conclusion

Any device or system that can connect to the Internet can send out a Measurement Protocol hit.  With features such as Custom Reports, there is no limit to the kind of reporting and analysis possible in Google Analytics.

 

Tell us what crazy kinds of data you send!

Leave a Comment