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

Update vue-gtag.d.ts #585

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

mwargan
Copy link

@mwargan mwargan commented Sep 10, 2024

Adds currency to EcommerceAction see #566 (comment)

No further changes required.

var purchase = (function (params) {
  event("purchase", params);
});

^ looks like it will pass the currency as needed, and from there Google will know what to do with it.

Adds currency to EcommerceAction
@mwargan
Copy link
Author

mwargan commented Sep 10, 2024

Note the typing is also used for the "refund" event, which is OK as Google Analytics also accepts, and even requests, a currency - see "* If you set value then currency is required for revenue metrics to be computed accurately.". This is also true for the Purchase event - see https://developers.google.com/analytics/devguides/collection/protocol/ga4/reference/events#purchase

@MatteoGabriele we may need to include a bit more advanced/dynamic typings to enforce this and/or do it on the code level.

image

Add union types to make currency required if value is provided, as per Google docs on the matter.
@mwargan
Copy link
Author

mwargan commented Sep 10, 2024

I've added a final touch-up to enforce that the currency is exactly 3 letters and uppercase

@mwargan
Copy link
Author

mwargan commented Sep 27, 2024

@MatteoGabriele can we get a move on this? This is actually quite important because this param is required according to Google.

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

Successfully merging this pull request may close these issues.

1 participant