{"id":5497,"date":"2023-01-15T14:21:30","date_gmt":"2023-01-15T11:21:30","guid":{"rendered":"https:\/\/trackingchef.com\/?p=5497"},"modified":"2023-04-16T13:04:20","modified_gmt":"2023-04-16T10:04:20","slug":"how-to-add-session-id-to-ga4-measurement-protocol-events","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/google-analytics\/how-to-add-session-id-to-ga4-measurement-protocol-events\/","title":{"rendered":"How to add Session ID to GA4 Measurement Protocol events?"},"content":{"rendered":"\n
I was recently helping a client migrate to GA4 (it’s right around the corner, July 1st, 2023<\/a>). This client, a SaaS B2B product, has a complex funnel, in which deals are closed offline via sales representatives. Most leads are generated on the marketing site and sent directly to their CRM (Hubspot), and from there the client wanted to report that conversion back to both GA4 and the various marketing platforms. Unsurprisingly, the answer was using GA’s Measurement Protocol API to report to GA. <\/p>\n\n\n\n But the reports connecting the conversion to user visits were broken and nobody knew why.<\/p>\n\n\n\n When I started investigating it, I found out that they didn\u2019t pass the session_id<\/em> param in the Measurement Protocol hit to GA4. HOLD ON? Sessions? In GA4? YES!<\/strong><\/p>\n\n\n\n Universal analytics was based on sessions, and once you passed the ga cookie id (i.e. client id) in the measurement protocol hit, then GA would match that hit to its corresponding \u201cplace\u201d, but GA4 is built on events and not sessions, and this is why we pass to \u201ctell\u201d GA the session_id.<\/p>\n\n\n\n Google hasn’t done the best job in terms of documentation on this one, to say the least. I went over the GA 4 documentation<\/a> for measurement protocol and CTR+F’d for \u201csession_id<\/em>\u201d, and came up short. I was however able to find this release<\/a> note from May \u201822 introducing the session_id <\/em>param, and further exploration led me to this thread<\/a> in which someone named Kevin from the Google Analytics API team acknowledges that Google needs to update their documentation on this matter (but can\u2019t commit on a timeline).<\/p>\n\n\n\n<\/figure>\n\n\n\n
<\/figure>\n\n\n\n