managed-components / managed-components/google-analytics-4

Update and fix audiences request

Open
#38 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
27
Forks
9
PR merge metrics
No merged PRs in 30d

Description

The current audience request for GA4 audiences from this MC does not work and is not a valid request for GA4.

We were using this and seeing 0 data in Google Ads, and Google Ads support noticed we were not sending a request with v=2, which is sent for GA4 audience requests. v=1 is the legacy version associated with (now dead) Universal Analytics.

We see v=1 in this MC,
https://github.com/managed-components/google-analytics-4/blob/a37816ab86a7750cab6ef8546707365e08bde2db/src/index.ts#L23

but the implementation and data structure looks like it was copied from the Universal Analytics MC logic.

If I run the Google Tag, I see a request like this with v2, and different fields:

https://analytics.google.com/g/collect with the following parameters:

  • v=2
  • tid=[Tag ID]
  • gtm=
  • _p=
  • _gaz=
  • gcs=G111 [consent v2]
  • gcd
  • npa
  • dma
  • tag_exp
  • cid
  • ul
  • sr
  • uaa
  • uab
  • uafvl
  • uamb
  • uam
  • uap
  • uapv
  • uaw
  • are
  • pae
  • frm
  • pscdl
  • _s
  • sid
  • sct
  • seg
  • dl
  • en=page_view
  • _ee
  • tfd

There are multiple reports of issues with Zaraz GA4 and audiences in #zaraz Discord.

There's also a request made for https://td.doubleclick.net/td/ga/rul with many params, which isn't part of this MC. Not sure if that's for a different type of tracking though.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read src/index.ts at line 23 and compare its audience request with the referenced Universal Analytics implementation. Use the Google Tag request details in the issue to identify the GA4 version and parameters that need updating. Done means the managed component sends a valid GA4 audience request using v=2 instead of the legacy v=1 request.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
analytics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.