What Is Measurement Protocol and How Does It Help Marketing Analysts
Today, Polina Okhai, Digital Analyst and Email Marketer at #ADINDEX shared her knowledge about Measurement Protocol in Google Analytics 4 and explained how it can help you better track your campaign performance.
Measurement Protocol is necessary for your business in the following cases:
- If you need to transmit data about offline purchases
- Fix invalid purchases of users who repeatedly visited the Thank You Page (the last page at checkout that the customer visits when placing an order).
- If you need to update data for e-commerce.
- If you need to send additional data about the user.
- When updating the user status in CRM.
- In the case of e-commerce, real conversions occur more frequently during a call-back from a consultant. This may lead to data discrepancies in Google Analytics.,
Measurement Protocol is a convenient and simple tool that can be implemented using most programming languages.
What Is Measurement Protocol
Measurement Protocol is a protocol for transmitting statistical data using HTTP requests (via the POST or GET method) to Google Analytics ( GA). In plain language, this tool collects additional client data from every other data source except your website
Measurement Protocol consists of a set of mandatory and optional parameters. The mandatory ones include:
- v - protocol version (as of now, 1);
- tid is the tracking ID of the GA resource, to which you will send the collected data;
- cid - client ID;
- t - the type of user interaction with the website. For example, page view, screen view, event, transaction, etc.
This basic set is necessary for the protocol to function and collect basic data. But you can tailor it to your business using optional parameters. Here you can find the full list of parameters. In this article, we'll consider a few of them to demonstrate the capabilities of the Measurement Protocol. Here are the parameters we’re going to discuss:
- User Agent Override (UA) is a parameter that allows you to get your browser's data sent to a web server to identify itself. Here’s an example:
- Document location URL (dl) - this parameter allows you to send the full URL to GA. Or the so-called path to the specific page of the site from which the protocol is sent.
- Transaction ID (ti) is a unique transaction identifier. It’s an essential parameter for high-quality analytics.
- Transaction Revenue (tr) is one of the most important parameters that allows you to control income. Transaction Revenue channels the total revenue from the transaction to GA, including shipping costs and taxes.
- Product Action (pa) sends an action performed with the selected product to GA. Some of the actions include viewing information, clicking, adding to the cart, removing from the cart, making a purchase, purchase, refund.
- Item Quantity(iq) transmits the number of purchased goods to GA.
We advise you to go through the full list of parameters and choose the best ones for you. Later on, we'll give an example of a Measurement Protocol that includes the above parameters:
As you may have noticed, the parameters are listed with the help of ampersand “&" and without spaces. Otherwise, the protocol won't work. At first glance, it might seem that there are too many details to keep an eye on. However, it's not as hard as it seems because there's a very useful Hit Builder tool that helps you easily create and validate the Measurement Protocol.
At this stage, you'll need to fill in the required parameters and add those that you think are suitable for your business. You can do this using the “Add parameter" button. After all the parameters are added, and the fields are filled in, you can check your request by clicking on the "Validate hit" button:
If there are no errors in your request, you can send data to GA. This tool is especially useful for sales managers. After any offline deal with a client, adding information about the transaction to analytics will be very easy.
In case of an error in the request, you'll see the following message:
However, in the new version of Google Analytics (GA 4), the Measurement Protocol has also been updated. At the time of writing this article, the second version of the protocol already exists. It contains significant changes from the first one.
And although both the new version of the protocol and GA 4 itself are still at the testing stage, you can already create new data streams in analytics and channel information with the help of the second version of the Measurement protocol. Let’s take a look at the changes:
- One of the key innovations, in our opinion, is the introduction of a mandatory parameter - the API key. You can generate this parameter in the "Admin" mode by going to the “Data Streams” section:
Next, go to the section "About Measurement Protocol API”:
After that, you'll receive a secret key:
Transferring the generated API key to the Measurement Protocol (MP) as a mandatory parameter solves the problem of redundant information in the database, which was a serious issue in the previous version.
- The request is formed, just like it was before, based on the principle of "key=value". However, you can test the values for some keys now.
- Previously, we used the Hit Builder constructor to create MP. In the new version we have GA4 Event Builder, which allows you to create requests, check them and send them to Google Analytics.
- In the first version of the Measurement Protocol, both POST and GET methods could be used. This possibility is missing in the second version, and only the POST method can be used.
- Previously, we sent a request to https://www.google-analytics.com/collect. Now, the endpoint is https://www.google-analytics.com/mp/collect
Ultimately, it should be mentioned that the Measurement Protocol tool is perfect for omnichannel businesses with both online and offline conversions. Hit Builder allows you to put offline leads to Google Analytics, providing you with more granular statistics. A deeper picture of your efforts grants better business performance and drives your growth.