partytown icon indicating copy to clipboard operation
partytown copied to clipboard

Deprecated APIs in use (GTM)

Open tlgimenes opened this issue 2 years ago • 5 comments

Hi folks,

I'm using Partytown on a Next.JS project for running Google Tag Manager. This works great, however, recently, lighthouse started reporting the following error:

image

Also, I'm getting this report on Chrome's DevTools.

This error only happens when I use Partytown + Google Tag Manager. Using GTM script directly on the main thread does not trigger this error. I tried to see if we use this API on partytown but could not find anything.

Anyone with any clue on this error? Thanks!

tlgimenes avatar May 11 '22 18:05 tlgimenes

I am seeing the same issue using next.js implementation for GTM

The error seemed to disappear if i set the headers to use atomics

jasonRufus avatar May 23 '22 14:05 jasonRufus

@jasonRufus I'm having the same problem with an application in gatsby. How did you enable this setting in atomics?

MarlonPassos-git avatar May 30 '22 12:05 MarlonPassos-git

Sorry seems i was mistaken, i have retested and the same error occurs when using atomics. @MarlonPassos-git but to answer your question, your site needs to be cross origin isolated. you do this by adding these 2 response headers: Cross-Origin-Embedder-Policy: credentialless Cross-Origin-Opener-Policy: same-origin Partytown will automatically use atomics if set. See more here: https://partytown.builder.io/atomics#document-response-headers

jasonRufus avatar May 30 '22 13:05 jasonRufus

@jasonRufus Chrome is talking about deprecating that API won't it be better to switch to using the alternate Event.computedPath() API

Plus, it seems there is polyfill available.

if (!Event.prototype.path) {
  Object.defineProperty(Event.prototype, 'path', {
    get() { return this.composedPath(); }
  });
}

okikio avatar Jun 22 '22 21:06 okikio

+1 on this issue. Is there another solution that wouldn't involve setting headers?

tjkohli avatar Jun 23 '22 22:06 tjkohli