Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google optimize doesn't work #128

Open
kstraszewski opened this issue Aug 7, 2022 · 1 comment
Open

Google optimize doesn't work #128

kstraszewski opened this issue Aug 7, 2022 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@kstraszewski
Copy link

kstraszewski commented Aug 7, 2022

Hi im trying to implement Google Optimize to nuxt3 using partytown. I've implement script adding new plugin to nuxt3:

export default defineNuxtPlugin((nuxtApp: NuxtApp) => {
  const config = useRuntimeConfig();
  useHead({
    script: [
      {
        src: `https://www.googleoptimize.com/optimize.js?id=${config.optimizeId}`,
        async: true,
        gtm: config.gtmId,
        type: 'text/partytown',
      }
    ],
  });
});

I see that script is loading properly:

<script src="https://www.googleoptimize.com/optimize.js?id=OPT-MMSMPHJ" async="true" type="text/partytown-x" gtm="GTM-W57WWW2"></script>

you can check, that the code above is generated here: https://qa.lendi.pl/

I've also tried to set forwarding by adding this to nuxt.config:

  partytown: {
    debug: true,
    logScriptExecution: true,
    logStackTraces: true,
    forward: ['google_optimize', 'google_tag_manager',],
  }

But unfortunately my optimize experiments does not work. When I change script type from text/partytown to text/javascript everything works fine

@joaopedrodcf
Copy link

Shouldn't the script contain type="text/partytown" Instead of type="text/partytown-x" ?

@danielroe danielroe added the documentation Improvements or additions to documentation label Sep 30, 2022 — with Volta.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants