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

asyncID with multiple id does not seem to work #117

Open
owalid opened this issue Jul 14, 2021 · 2 comments
Open

asyncID with multiple id does not seem to work #117

owalid opened this issue Jul 14, 2021 · 2 comments

Comments

@owalid
Copy link

owalid commented Jul 14, 2021

Hello

I would like to add a google analytics from my store. I use asyncID. This code works well in dev but in production I have only the first id which is static. My store is init at the nuxtServerInit level

Am I doing something wrong?

nuxt.config.js:

....

 buildModules: [
  ....
    '@nuxtjs/google-analytics'
  ....
  ],

googleAnalytics: {
    checkDuplicatedScript: true,
    autoTracking: {
      screenview: true
    },
    debug: {
      enabled: process.env.NODE_ENV === "developpement",
      sendHitTask: process.env.NODE_ENV !== "developpement"
    },
    asyncID: (context) => {
      const stats = context.store.getters['shop/getShopStats']

      return (stats && stats.google_analytics_account) ? ['UA-xxxx-xxx' stats.google_analytics_account] : ['UA-xxxx-x']
    }
  },


 plugins: [
  ....
    '~/plugins/client/gtag.client',
  ....
  ],

gtag.client.js:

export default ({ app }) => {
  app.$ga.page({
    page: '/',
    title: 'Home page',
    location: window.location.href
  })
}
@1shaked
Copy link

1shaked commented Aug 8, 2021

same here I can not use multiple ids

@vagnerolliver
Copy link

HI! I will need to use multiple id to... Is it resolved?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants