feat(platform): consent to optional cookies through native ios framework#1845
feat(platform): consent to optional cookies through native ios framework#1845dargmuesli wants to merge 3 commits intomainfrom
Conversation
In favor of native tracking tooling.
| onUnmounted(() => { | ||
| if (import.meta.client) { | ||
| window.removeEventListener( | ||
| 'tracking-permission-result', | ||
| handleTrackingPermissionResult, | ||
| ) | ||
| } | ||
| }) |
There was a problem hiding this comment.
Using https://vueuse.org/core/useEventListener/ would simplify the mount/unmount logic, just an idea.
| } | ||
|
|
||
| onMounted(() => { | ||
| if (import.meta.client) { |
There was a problem hiding this comment.
onMounted should only be run on the client, so import.meta.client is not needed I'd say
| } | ||
| }) | ||
|
|
||
| const isIOS = computed(() => { |
There was a problem hiding this comment.
Can we use isAppIos from usePlatform() instead?
There was a problem hiding this comment.
Let's check if there is a way for the app to tell iOS to show the permission dialog again. Alternatively, we should hide the cookie button under the hamburger menu.
| const handleTrackingPermissionResult = (event: Event) => { | ||
| const customEvent = event as CustomEvent<string> | ||
| if (customEvent.detail === 'authorized') { | ||
| cookieControl.cookiesEnabledIds.value = [GTAG_COOKIE_ID] |
There was a problem hiding this comment.
I think we can dynamically load the full list of optional cookies, something like:
const { moduleOptions } = useCookieControl()
moduleOptions.cookies.optional.map((x) => id.id)It would be best to have this utility function exported, but I don't find time to work on the cookie module currently, will maybe do this soon.
📚 Description
Consent for optional cookies should be set using the native ios tracking framework. AppTracking permission now acts as acceptance of cookies.
TODO:
cc @huzaifaedhi22
📝 Checklist