analytics-debugger / ga4mp

GA4MP
MIT License
40 stars 11 forks source link

User agent and client hints not in payload/query string #7

Closed mosenturm closed 1 year ago

mosenturm commented 1 year ago

Hi,

if I fire following tag (GTM) on every page view:

<script>
  var ga4track = ga4mp(["G-XXXXXXXX"], {
    // client_id: '123123123.123123123123', // autogenerate
    user_id: undefined,
    endpoint: {{Ping - Endpoint}},
    non_personalized_ads: true,
    user_ip_address: '0.0.0.0',
    debug: true
  });

  ga4track.trackEvent('page_view', {
    is_session_start: true, 
    is_first_visit: true,
    google_consent_state: 'G100',
})        
</script>

there are no

in the payload for building the query string for the endpoint request. Anything else is present and working like expected.

Can you show me the right way for getting these parameters into the query string?

Thanks for the code! It is very useful for my daily work.

Andreas

thyngster commented 1 year ago

Please be aware that not all browsers will send the CH, that may be the reason for not seeing them.

mosenturm commented 1 year ago

If I do a console.log in ga4mp.js there are CH and UA string.

thyngster commented 1 year ago

I'm trying your example code and it's being populated properly at my side:

v: 2 tid: G-XXXXXXXX cid: 654031011.1678034585 _dbg: 1 _npa: 1 _s: 1 sid: 1678034585 sct: 1 uip: 0.0.0.0 dl: https://demo dr: dt: ul: en-us sr: 2560x1440 uaa: x86 uab: 64 uafvl: Chromium%3B110.0.5481.178%7CNot%20A(Brand%3B24.0.0.0%7CGoogle%20Chrome%3B110.0.5481.178 uamb: 0 uam: uap: Windows uapv: 15.0.0 uaw: 0 seg: 1 _ss: 1 _fv: 1 gcs: G100 en: page_view

Can you provide a link or demo so I can review it?

thyngster commented 1 year ago

Nevermind, I was able to replicate it.

thyngster commented 1 year ago

@mosenturm this should be fixed on the new 0.0.3 version.