GA4 doesn't collect my event parameter but GTM collects

14 Views Asked by At

I'm currently new to GA4 + GTM

What I wanna do is, whenever I click button , I will run function login and if login is successful, I want to collect user A has logged in. (Just a test case!!)

So what I did is,

setting all snippets on head, Run below function which pushes data to dataLayer.

function collectGTMEvent(eventName, ...param) {
    if (!window) {
      console.warn("WARNING: current execution environment is not browser");
      return;
    }
    if (!window.dataLayer) {
      console.warn("WARNING: GA script is not loaded");
      return;
    }
    window.dataLayer.push({
      event: eventName,
      ...param,
    });
    }

Whenever I run function, event parameters aren't collected in GA4 debug view, but collected in GTM debug tool.

and whenever I set a default value to event parameter value, on GA4 debug view, only default value is shown (which means my parameters which are passed to dataLayer.push function aren't passed to GA4...)

I've strongly confident that there wasn't any error while configuring GTM. + GA4 datastream

GTM debug result

0

There are 0 best solutions below