Closed juanpprieto closed 1 month ago
Oxygen deployed a preview of your juanpprieto/fix-analytics branch. Details: |
Storefront | Status | Preview link | Deployment details | Last update (UTC) |
---|---|---|---|---|---|
custom-cart-method | ✅ Successful (Logs) | Preview deployment | Inspect deployment | May 14, 2024 6:49 PM | |
vite | ✅ Successful (Logs) | Preview deployment | Inspect deployment | May 14, 2024 6:49 PM | |
third-party-queries-caching | ✅ Successful (Logs) | Preview deployment | Inspect deployment | May 14, 2024 6:49 PM | |
optimistic-cart-ui | ✅ Successful (Logs) | Preview deployment | Inspect deployment | May 14, 2024 6:50 PM | |
subscriptions | ✅ Successful (Logs) | Preview deployment | Inspect deployment | May 14, 2024 6:50 PM | |
Skeleton (skeleton.hydrogen.shop) | ✅ Successful (Logs) | Preview deployment | Inspect deployment | May 14, 2024 6:49 PM |
Learn more about Hydrogen's GitHub integration.
Yes, the args to setTrackingConsent
are booleans. Full types:
export interface SetGranularConsentParameter {
[ConsentDisplayKeys.MARKETING]?: boolean;
[ConsentDisplayKeys.ANALYTICS]?: boolean;
[ConsentDisplayKeys.PREFERENCES]?: boolean;
[ConsentDisplayKeys.SALE_OF_DATA]?: boolean;
[ConsentDisplayKeys.EMAIL]?: String;
[StorefrontApiConsentMetadata.HEADLESS_STOREFRONT]?: boolean;
[StorefrontApiConsentMetadata.ROOT_DOMAIN]?: string;
[StorefrontApiConsentMetadata.CHECKOUT_ROOT_DOMAIN]?: string;
[StorefrontApiConsentMetadata.STOREFRONT_ROOT_DOMAIN]?: string;
[StorefrontApiConsentMetadata.STOREFRONT_ACCESS_TOKEN]?: string;
[StorefrontApiConsentMetadata.IS_EXTENSION_TOKEN]?: boolean;
[StorefrontApiConsentMetadata.METAFIELDS]?: Metafield[];
}
export function setTrackingConsent(
consent: boolean | SetGranularConsentParameter,
callback?: (err?: null | {}, success?: {}) => {} | void,
): setTrackingConsentPromise
Do not use the shorthard (setTrackingConsent(false, () => console.log("everything declined")
) as that is deprecated, it's legacy from where consent was binary and not per purpose.
We detected some changes in packages/*/package.json
or packages/*/src
, and there are no updates in the .changeset
.
If the changes are user-facing and should cause a version bump, run npm run changeset add
to track your changes and include them in the next release CHANGELOG.
If you are making simple updates to examples or documentation, you do not need to add a changeset.
These are some fixes and optimizations based on a 3P consent implementation.
[x] Add validation and error logging to ensure
conset.storefrontAccessToken
is a valid public token and not a server token [x] Add an explicit return type ofCustomerPrivacy | null
togetCustomerPrivacy
[x] Add a type of(data: {error: string} | undefined) => void
to thesetTrackingConsent
callback [x] Fix theVisitorConsent
type to expectBoolean
values instead of"true"
,"false"
strings. While implementing a 3P consent sync with Shopify, we noticed thatsale_of_data
must be aboolean
orsetTrackingConsent
would error. @alejandro-shopify could you confirm that these can bebooleans
? CC @wizardlyhel