Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: last custom property is persisted #323

Open
fogx opened this issue Jan 8, 2023 · 2 comments
Open

Bug: last custom property is persisted #323

fogx opened this issue Jan 8, 2023 · 2 comments

Comments

@fogx
Copy link

fogx commented Jan 8, 2023

Info

When sending an event with custom parameters, the last parameters will be persisted to further calls if they are not overwritten. I'm not sure if this is intentional, but it's very annoying, since this makes other events send totally irrelevant data.
The dataLayer push is correct, but the actual values transmitted to GA4 are not.

Tool Version
Plugin v2
Vue v3.2.45

Input

  gtm.trackEvent({
    event: "test",
    event_parameter: "format",
    event_parameter_value: "test_value",
    user_property: "test_property",
    user_property_value: "test_prop_value"
  });
gtm.trackEvent({event: "test_followup"});

Output or Error

DataLayer - everything is correct here

dataLayer.push({
  event: "test",
  target: null,
  action: null,
  target-properties: null,
  value: null,
  interaction-type: false,
  event_parameter: "format",
  event_parameter_value: "test_value",
  user_property: "test_property",
  user_property_value: "test_prop_value",
  gtm.uniqueEventId: 1
})
dataLayer.push({
  event: "test2",
  target: null,
  action: null,
  target-properties: null,
  value: null,
  interaction-type: false,
  gtm.uniqueEventId: 2
})

gtag output - you can see the second test event also has the format property, eventhough it was not defined.

gtag("event", "test", {
  format: "test_value", // this is correct and as specified
  user_properties: {test_property: "test_prop_value"},
  send_to: "G-XXXX"
})

gtag("event", "test_2", {
  format: "test_value", // this should not be here!
  user_properties: {test_property: "test_prop_value"},
  send_to: "G-XXXXX"
})

Expected Output

gtag("event", "test", {
  format: "test_value",
  user_properties: {test_property: "test_prop_value"},
  send_to: "G-XXXX"
})

gtag("event", "test_2", {
  user_properties: {test_property: "test_prop_value"},
  send_to: "G-XXXXX"
})

Additional Context

If i send three events after each other, only the last custom parameter is persisted -> makes it seem even more like a bug 🤔
Since GA4 does not use action, category etc. anymore, the user has to specify their own parameter name and values.

@fogx fogx changed the title Bug: custom properties are Bug: last custom property is persisted Jan 8, 2023
@Shinigami92
Copy link
Contributor

Please add a test here: https://github.com/gtm-support/core/blob/main/tests/gtm-support.test.ts
and try to reproduce it

But I see you are using GA / gtag, this is not related to this repo 🤔

@fogx
Copy link
Author

fogx commented Jan 10, 2023

Please add a test here: https://github.com/gtm-support/core/blob/main/tests/gtm-support.test.ts
and try to reproduce it

Ok ill do that

But I see you are using GA / gtag, this is not related to this repo 🤔

i don't understand. I'm using this repo (see input) to send the data to the datalayer. It uses gtag under the hood. The outputs that i pasted are from the GTM preview, not code snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants