Open lukasaric opened 1 year ago
Hi @lukasaric,
This module is a wrapper of @gtm-support/vue-gtm, may be you can ask this feature to the author.
But, I think you can extend the type TrackEventOptions
of the @gtm-support/core to add your custom props.
export interface TrackEventOptions {
[key: string]: any;
event?: string;
category?: any;
action?: any;
label?: any;
value?: any;
noninteraction?: boolean;
}
Hi @lukasaric,
This module is a wrapper of @gtm-support/vue-gtm, may be you can ask this feature to the author.
But, I think you can extend the type
TrackEventOptions
of the @gtm-support/core to add your custom props.export interface TrackEventOptions { [key: string]: any; event?: string; category?: any; action?: any; label?: any; value?: any; noninteraction?: boolean; }
Hey!
Well, I’s not problem with the types, they are fine (you can add additional custom props). Problem is that even if you add them, these predefined prop values will be still persisted. e.g:
gtm.trackEvent({ custom: 'test' })
// object in data layer will be: { custom: 'test', event: null, value: null …. }
But thanks anyways, I think I should ask gtm support for this since as you said, this is only a wrapper.
Here's the reason why are there prefined values: https://github.com/gtm-support/core/blob/1ddebc22ade4dc0367a885630bb5689364f7456f/src/gtm-support.ts#L213C13-L213C13
@LouisMazel raised a feature request and PR on the gtm-support/core: https://github.com/gtm-support/core/issues/351#issuecomment-1732528872
After it gets merged and version bumped, then you can bump the version here too! Thanks
@LouisMazel latest gtm-core release with the new push feature
@michael-bouvy Can you update the dependency and release?
@LouisMazel Technically, we don't need to update the dependency (since it's not fixed version => ^2.0.0
). It won't hurt, but now the push
method is available.
@LouisMazel @michael-bouvy Currently when I try to use
gtm.trackEvent
it has some prefined props (event, value etc) already set.Is there a way to omit all the predefined props and just use the custom ones? (I want to have object that ends up in the
datalayer
completely purified from those predefined values)If no, is there a possibility to add this as a feature?