MatteoGabriele / vue-gtag

Global Site Tag plugin for Vue (gtag.js)
https://matteo-gabriele.gitbook.io/vue-gtag/
MIT License
870 stars 67 forks source link

Proxying vue-gtag using Nginx to bypass Adblock and other blockers #264

Closed xaander1 closed 3 years ago

xaander1 commented 3 years ago

Is it possible to change the analytics domain where vue-gtag points to in order to bypass adblock and other blockers. Here is a guide of what I mean : using nginx to bypass blockers So instead of: https://www.google-analytics.com/analytics.js to point to /analytics.js

Or how does vue-gtag address blockers??

camero2734 commented 3 years ago

Got this working by using the customResourceURL. In this case, I mapped it to /gtag:

// This is @nuxtjs/proxy
"/gtag": {
      target: "https://www.googletagmanager.com",
      pathRewrite: {
        "/gtag": "/gtag/js"
      },
      secure: true
}

// vue-gtag config
Vue.use(
    VueGtag,
    {
      config: { id: ctx.env.gaId },
      customResourceURL: "/gtag"
    },
    ctx.app.router
);
xaander1 commented 3 years ago

How are you automatically getting the route in ​ctx​.​app​.​router​

Never mind found it: stackoverflow access-nuxt-js-context-in-vue-plugin :100: :+1:

Thanks btw