firebase-js-sdk icon indicating copy to clipboard operation
firebase-js-sdk copied to clipboard

Analytics: Fix update consent method

Open kuczmaja opened this issue 1 year ago • 3 comments

To send the user's consent status, second arg must be 'default' or 'update'

gtag('consent', 'update', {
    'analytics_storage': 'granted',
    // ....
});

While destructing args in gtagWrapper, the first item is the string, and ConsentSettings is given as the second parameter.

const [gtagParams] = args; // args is [ 'update', { 'analytics_storage': ... } ]
gtagCore(GtagCommand.CONSENT, 'update', gtagParams as ConsentSettings); // gtagParams is 'update' in this case

kuczmaja avatar Mar 05 '24 12:03 kuczmaja

🦋 Changeset detected

Latest commit: cf3a06b6bb830dbfaa11a8a2ea7d3dfc9690befa

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@firebase/analytics Patch
@firebase/analytics-compat Patch
firebase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

changeset-bot[bot] avatar Mar 05 '24 12:03 changeset-bot[bot]

Thanks for the review. The changeset is added.

kuczmaja avatar Mar 25 '24 10:03 kuczmaja

Thank you for the fix. Could you please provide an update on the status of the PR? Much appreciated!

yafanasiev01 avatar Apr 16 '24 12:04 yafanasiev01