![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/vreg/node_modules/@nuxtjs/gtm/lib/ |
// This is a mock version because gtm module is disabled // You can explicitly enable module using `gtm.enabled: true` in nuxt.config import { log } from './gtm.utils' const _layer = '<%= options.layer %>' const _id = '<%= options.id %>' function startPageTracking (ctx) { ctx.app.router.afterEach((to) => { setTimeout(() => { ctx.$gtm.push(to.gtm || { routeName: to.name, pageType: 'PageView', pageUrl: '<%= options.routerBase %>' + to.fullPath, pageTitle: (typeof document !== 'undefined' && document.title) || '', event: '<%= options.pageViewEventName %>' }) }, 250) }) } export default function (ctx, inject) { log('Using mocked API. Real GTM events will not be reported.') const gtm = { init: (id) => { log('init', id) }, push: (event) => { log('push', process.client ? event : JSON.stringify(event)) if (typeof event.eventCallback === 'function') { event.eventCallback() } } } ctx.$gtm = gtm inject('gtm', gtm) <% if (options.pageTracking) { %>if (process.client) { startPageTracking(ctx); }<% } %> }