partytown icon indicating copy to clipboard operation
partytown copied to clipboard

TypeError: document.getElementsByTagName(...).item is not a function with ChatPlus script

Open RyunosukeSekido opened this issue 7 months ago • 1 comments

Description:

The third-party script for ChatPlus is throwing a TypeError: document.getElementsByTagName(...).item is not a function error when executed within Partytown. This issue prevents ChatPlus from functioning correctly when Partytown is enabled.

nuxtjs/partytown Version:

$ yarn list --pattern @nuxtjs/partytown
└─ @nuxtjs/[email protected]

Code Snippet (nuxt.config.ts):

export default defineNuxtConfig({
  modules: ["@nuxtjs/partytown"],
  partytown: {
    debug: true
  },
  app: {
    head: {
      script: [
        {
          src: "https://app.chatplus.jp/cp.js",
          async: true,
          type: "text/partytown",
          body: true,
        },
      ],
    },
  },
});

Current behavior:

The script is embedded as follows

<script async type="text/partytown" src="https://app.chatplus.jp/cp.js" data-pterror="TypeError: document.getElementsByTagName(...).item is not a function...."></script>

This is the error message that is output

Image

RyunosukeSekido avatar May 22 '25 04:05 RyunosukeSekido

The problem here is that when insert DOM into the application via GTM, the DOM is not displayed. Is there a way to disable Partytown for individual tools in GTM?

noriyuki-shimizu avatar May 28 '25 04:05 noriyuki-shimizu