MeasureCamp London 2024 - Yasen - Measurement Protocol v2
YasenLilov
159 views
43 slides
Sep 24, 2024
Slide 1 of 43
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
About This Presentation
Overview of the measurement protocol since its inception, with learnings and tips and tricks since the major change to v2 (UA Deprecation).
Size: 19.2 MB
Language: en
Added: Sep 24, 2024
Slides: 43 pages
Slide Content
GA4 Measurement Protocol v2: Lessons learned from the trenches
Link to article Link to video
2 years later…
Link to Article 1 Link to Article 2
The measurement protocol has been here for a while.
What is the measurement protocol? The Measurement Protocol is one of Google Analytics 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. An article written many moons ago. Reference to Universal Analytics Architecture
What can you do with it? Google Ads Audiences Reporting Conversion Export Online to offline Send offline events to Google Analytics (e.g. CRM) Predictive events Import predictive models for likelihood to purchase, or predictive lifetime value New environments Send data from any internet-connected device such as a kiosk or point of sale system GA HTTP HTTP HTTP Advanced
Measurement Protocol - Universal Analytics (v1)
Measurement Protocol - Universal Analytics (v1) Measurement Protocol - Google Analytics 4 (v2) Yasen Lilov Partner, Head of Data & Analytics VertoDigital
Changelog Oct 2020 May 2022 Initial MP v2 release Jan 2023 GA4 automatically joins GEO data based on client_id / app_instance_id Jul 2023 camaign_details event introduced to manually set acquisition information for future events Sep 2024 session_id included as param so that events can appear in session-based reporting. GA4 automatically joins device details data based on client_id / app_instance_id Battle 2 Battle 3 Battle 1
Oct 2020 Sep 2024 Battle 2 Battle 3 Battle 1
BATTLE 1
Battle 1 - Mission Brief Objective Client Context Architecture Integrate marketing website, product & server-side engagement to report on key user interactions across the whole user journey. Use GA4 as kind-of-a-product-analytics-tool Industry: SaaS Business Model: Hybrid - B2B & B2C Product: Website speed optimisation software KPIs: New Accounts, Plan Upgrade, MRR Web Marketing site Server Middleware MP v2 Web stream Web Product Q1 2022
Battle 1 - Learnings Q1 2022 Thanks for sending us a developer guide, but h ow can we debug and troubleshoot if the HTTP requests we send are working? Client Developer The Google Analytics Measurement Protocol does not return HTTP error codes , even if an event is malformed or missing required parameters. Documentation
Battle 1 - Learnings Q1 2022 Postman collection Top tip: Use Postman when designing and testing MP payloads MP Validation Server
Battle 1 - Learnings Q1 2022 Stage 1: Validation Server Stage 2: GA4 Test Property / Data Stream Stage 3: GA4 Prod Property / Data Stream Top tip: Develop and send data in stages
Battle 1 - Learnings Q1 2022 Great work, implementation seems to be working just fine! We have this subscription_activate event where we pass a mrr_value as a parameter. Can we do something so that we can create a conversion for “free” subscriptions (i.e. when mrr_value is 0) without making any code changes? Client
Battle 1 - Learnings Q1 2022 Measurement protocol events cannot be modified from the UI using the Create Event / Modify Event functionality. This is because this is designed to happen client-side within the context of the browser via the gtag.js library. Where was that documented back then?
Battle 1 - Learnings - Summary Objective Architecture Q3 2022 Debug, debug, debug Use Validation Server #MeasureSlack community is golden. Develop in stages
BATTLE 2
Battle 2 - Mission Brief Objective Client Context Architecture Blend online and offline user behavior to provide signals for good/bad leads modelling in BigQuery. Feed offline signals for campaign optimisation in Google Ads. MP v1 already in place, migrate to MP v2. Industry: FinTech Business Model: B2C Product: App with credit card and perks KPIs: New Accounts, Accounts Approved Web Marketing site CRM Middleware MP v2 Web stream Q3 2022 DWH
Battle 2 - Learnings Objective Architecture Q3 2022 Google have just released the Sessionization functionality so as long as we capture session_id and send it, events should be attributed to session sources. dodov.dev Blog - How to get GA4 Session ID Updated requirements Capture from the online session: client_id session_id Provide from GA4: measurement_id api_secret
Battle 2 - Learnings - Anomaly 1 Objective Architecture Q3 2022 Spike in Unassigned traffic Some events attributed correctly , but majority to source / medium = (not set) Maybe it’s because of the formatting of the session_id - not clear if it should be a number or a string. Maybe it’s something to do with the timeframe of leads becoming approved accounts. Or GA4 is just being weird.
Battle 2 - Learnings - Anomaly 1 Objective Architecture Q3 2022 Fast-forward a few months Here’s the documentation we’ve been looking for… The timestamp (in microseconds) of the event, set to a maximum 72 hours into the past , measured from the moment you dispatch the Measurement Protocol request. Thanks G o o g l e Simo Link to Simo Ahava’s article
Battle 2 - Learnings - Anomaly 2 Objective Architecture Q3 2022 acc_approved 100 g oogle / cpc 10 … … (not set) 9 asc_approved acc_approved 5 Somehow Google Ads was able to attribute conversions to source / medium only based on client_id, whereas GA4 was not, even though the conversion itself was linked from GA4. How? Maybe magic.
Battle 2 - Learnings - Summary Objective Architecture Q3 2022 All about the session_id It represents a timestamp & c an be captured from the ga_<<G-XXXXX> Cookie Attribution across GMP is funky. Must be within 72h of the original session you are trying to tie the event to.
BATTLE 3
Battle 3 - Mission Brief Objective Client Context Architecture Blend app, web and offline data to provide a cross-device user journey view. Report on ROAS (spend vs deposits) and activate audiences based on user engagement. Industry: FinTech Business Model: B2C Product: Crypto bank & exchange KPIs: New Accounts, Deposits, Exchanges Web Marketing site DWH Middleware MP v2 Web stream Apps React iOS Android iOS stream Android stream MP v2 Web Platform Q1 2024
Battle 3 - Challenges Objective Q1 2024 Web Marketing site DWH Middleware MP v2 Web stream Apps React iOS Android iOS stream Android stream Web Platform 2 3 1 1 Transactional events occur offline 2 Middleware does not differentiate app vs web 3 Segment is configured only for web - app-based transactional events fall into the abyss 4 4 Consent Mode needed to be implemented too
Battle 3 - Actions Objective Q1 2024 Web Marketing site DWH Middleware MP v2 Web stream Apps React iOS Android iOS stream Android stream MP v2 Web Platform 1 2 3 1 2 3 You need to be able to separate data flow into separate Destinations (applies to Segment) Same requirements apply for MP v2 for Apps, but instead of client_id you need to provide app_instance_id You generate the required api_key & measurement_id on the stream level - i.e. you have two - one for iOS & Android. 4 4 Having a mechanism to “refresh” the session_id frequently (i.e. on login) reduces the % unassigned traffic / events you’ll see. 5 Consent is inherited from online interactions, but better implement at the source. 5
Battle 3 - Learnings - Summary Objective Q1 2024 More data sources, more fun pain MP v2 for apps is trickier - separation required. Consent is inherited from online events (if not specified), but implement at the source. Keep the session_id fresh
That’s enough confusing battle references.
Changelog Oct 2020 May 2022 Initial release Jan 2023 GA4 automatically joins GEO data based on client_id / app_instance_id Jul 2023 camaign_details event introduced to manually set acquisition information for future events Sep 2024 session_id included as param so that events can appear in session-based reporting. GA4 automatically joins device details data based on client_id / app_instance_id ? Measurement Protocol use cases Last updated 2024-08-14 UTC.
Objective Link to documentation
Summary Objective Make sure you use the Validation Server for Debugging Be aware test events will not appear in UI Use Postman when designing and testing payloads Design and develop MP in stages - Validation Server / Staging Property / Prod Property Can’t modify / create events from measurement protocol-based events. session_id You can capture the session_id from an existing cookie It's a timestamp in microseconds Make sure offline events occur within 72h of original session Make sure you have a mechanism to refresh its value Consent is inherited from online events (if not specified), but better implement at the source. Separate data pipelines are required for Web, iOS and Android. Some new updates are cooking ? - Different use-cases with and without session_id, with new 24h requirement?
Comparison v1 vs v2 Measurement Protocol v1 (UA) Measurement Protocol v2 (GA4) Endpoint and Authentication Uses www.google-analytics.com/collect endpoint without requiring an API Secret. Utilises www.google-analytics.com/mp/collect for standard hits and requiring an API Secret for authentication. Data Sending Method Data sent as parameters in a single hit with a rigid structure. Hit types dictate data type. Emphasises a flexible JSON payload structure, allowing for complex and detailed data representation as well as sending events in a batch. Event Model and Parameters Relies on a category-action-label-value structure for events, limiting event data complexity. Offers a flexible event model with up to 25 parameters, enabling detailed and specific event data. Session Handling Manual session control available using 'session control' parameter. Automated session handling based on user activity and time thresholds, without manual intervention. Sessions cannot be controlled using the measurement protocol. Cross-Platform Tracking More web-centric, with limited support for cross-platform scenarios. Designed for cross-platform tracking, reflecting the growing need for seamless web and app analytics integration.
Yasen Lilov Partner, Head of Data & Analytics VertoDigital Thank you! /in/yasenlilov/ [email protected] Scan to connect!