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 Tag Manager tag is not firing when viewing the page; we have to reload the page. #1688

Open
ngocvinh208 opened this issue Jun 28, 2023 · 1 comment

Comments

@ngocvinh208
Copy link

ngocvinh208 commented Jun 28, 2023

Description

When trying to build with Vue GTM module Google Tag Manager tag is not firing when viewing the page so we have to reload the page. I think because this is a third-party service, it only renders itself once per page load.?

Steps to reproduce

Configure it in main.js

  import VueGtm from '@gtm-support/vue2-gtm';
  export default function(Vue, { router, head, isClient }) {
  
      if( process.isClient){
          Vue.use(VueGtm, {
              id: 'GTM-PR7VTQG',
              vueRouter: router,
              enabled: true,
              debug: true,
          });
      }
    }

Configure it in my component

export default {
   name: "WpPage",
   components: {
     BlockBase: () => import('../components/BlockBase.vue'),
     MetaInfo: () => import('../components/MetaInfo.vue'),
     EventsCollective: () => import('../components/EventsCollective.vue'),
     NewsCollective: () => import('../components/NewsCollective.vue'),
     ArchivedEvents: () => import('../components/ArchivedEvents.vue'),
   },
   mounted() {
     var mainTitle = this.$page.wpPage.title;
     this.$gtm.trackView(mainTitle, window.location.pathname)
   },
 };  

Expected result

I am expecting GTM to fire the website.

Actual result

GTM tag is not firing the website

Environment

Node version: v14
Gridsome version: v0.7.20
Vue version : v2.6.12
OS: Mac

@a-kriya
Copy link

a-kriya commented Jul 19, 2023

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

2 participants