Repository analytics-module

ismatim

ismatim posted a new question

analytics-module β€’ 25 days ago

Error with Route Name in ScreenView.

Hi,

I have an issue when I want to enable ScreenView of Vue-Analytics:

Uncaught (in promise) Error: [vue-analytics] Route name is mandatory when using screenview.

[
    '@nuxtjs/google-analytics',
    {
      id: 'UA-XXX-X',
      debug: {
        sendHitTask: true,
        enabled: true,
        trace: false
      },
      autoTracking: {
        screenview: true
      }
    }
  ]

Any idea what's going on ?

amrshakya

amrshakya posted a new question

analytics-module β€’ a month ago

two requests are fetching the same GA script js file on firefox browser

im using @nuxtjs/google-analytics and seems like two requests are fetching the same GA script.js file on firefox browser. In chrome it just fetch once. Can anyone help me out

lucpotage

lucpotage posted a new bug report

analytics-module β€’ 3 months ago

bug Unrealistic bounce rate of 10%

Version

2.0.2

Reproduction link

https://www.myscript.com

Steps to reproduce

Installing the module.

What is expected ?

To have a realistic bounce rate.

What is actually happening?

I get a 10% bounce rate which is super low. I'm thinking something is broken with the module.

Here is the link about bounce rates: http://www.gorocketfuel.com/the-rocket-blog/whats-the-average-bounce-rate-in-google-analytics/

homerjam

homerjam posted a new feature request

analytics-module β€’ 3 months ago

idea Urgent: Please publish master to npm so we can opt out for GDPR compliance!

What problem does this feature solve?

Hi - this solves the issue of not being able to opt-out of analytics which is necessary for GDPR compliance in the EU. Your swift attention is most kindly appreciated πŸ™ πŸ˜„

lucpotage

lucpotage resolved the question #c18

analytics-module β€’ 3 months ago

this.$ga is undefined

It does not work inside a mixin. So I moved it into a Vue file directly and it worked.

lucpotage

lucpotage posted a new question

analytics-module β€’ 3 months ago

this.$ga is undefined

I would like to track outbound links with Google Analytics. I tried to add a mixin with the function descibed here but I can't access to this.$ga.
I don't think I have to add Vue Analytics as a plugin on top of this module.

sobolevn

sobolevn posted a new feature request

analytics-module β€’ 3 months ago

idea Add github issue template

What problem does this feature solve?

When creating my first issue for this project I was not informed on how to do it properly.
Since there's no clean sign about using cmty.io.

So, for future contributors it would be very nice to add a template that states, that issues must be created on cmty.io.
Or they will be closed otherwise.

What does the proposed changes look like?

Related: https://github.com/nuxt-community/analytics-module/issues/16

sobolevn

sobolevn posted a new bug report

analytics-module β€’ 3 months ago

bug npm run test does not work

Version

master

Reproduction link

https://github.com/nuxt-community/analytics-module/issues/16

Steps to reproduce

  1. git clone this repo
  2. npm i
  3. npm test

What is expected ?

I expect that tests will be executed without any errors.

What is actually happening?

Tests fail.
Output:

Β» npm run test

> @nuxtjs/[email protected]2.0.2 test /Users/sobolev/Desktop/analytics-module
> npm run lint && jest


> @nuxtjs/[email protected]2.0.2 lint /Users/sobolev/Desktop/analytics-module
> eslint lib src test

  console.error node_modules/nuxt/lib/core/nuxt.js:166
    Error: [nuxt] Module undefined should export a function
        at ModuleContainer.addModule (/Users/sobolev/Desktop/analytics-module/node_modules/nuxt/lib/core/module.js:113:13)
        at promise.then (/Users/sobolev/Desktop/analytics-module/node_modules/nuxt/lib/common/utils.js:61:61)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:160:7)

Build completed in 12.375s% 

  console.log node_modules/progress-bar-webpack-plugin/node_modules/progress/lib/node-progress.js:179


  console.log node_modules/progress-bar-webpack-plugin/node_modules/progress/lib/node-progress.js:179


  console.log node_modules/friendly-errors-webpack-plugin/src/output.js:81



























  console.log node_modules/friendly-errors-webpack-plugin/src/output.js:103
     DONE  Compiled successfully in 12379ms                               2:40:38 PM

  console.log node_modules/friendly-errors-webpack-plugin/src/output.js:103


  console.log node_modules/nuxt/lib/builder/builder.js:485
    Hash: 129f262eedf51f4aaa86
    Version: webpack 3.12.0
    Time: 12379ms
                                      Asset       Size  Chunks             Chunk Names
        pages/index.d1944e94f3fa94fff074.js  410 bytes       0  [emitted]  pages/index
    layouts/default.cc1854ad9412fd1849aa.js  326 bytes       1  [emitted]  layouts/default
             vendor.a6e76812813970cf0d37.js     144 kB       2  [emitted]  vendor
                app.07d83a8721058ce9e65d.js      26 kB       3  [emitted]  app
           manifest.129f262eedf51f4aaa86.js    1.47 kB       4  [emitted]  manifest
                                   LICENSES  584 bytes          [emitted]  
     + 3 hidden assets

 FAIL  test/module.test.js (17.236s)
  Module
    βœ• render (30ms)

  ● Module β€Ί render

    StatusCodeError: 404 - "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot GET /</pre>\n</body>\n</html>\n"

      at new StatusCodeError (node_modules/request-promise-core/lib/errors.js:32:15)
      at Request.plumbing.callback (node_modules/request-promise-core/lib/plumbing.js:104:33)
      at Request.RP$callback [as _callback] (node_modules/request-promise-core/lib/plumbing.js:46:31)
      at Request.self.callback (node_modules/request/request.js:186:22)
      at Request.<anonymous> (node_modules/request/request.js:1163:10)
      at IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|
Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        17.878s
Ran all test suites.
  console.log node_modules/nuxt/lib/builder/builder.js:485
    Hash: 0b33a0986a0638a57d72
    Version: webpack 3.12.0
    Time: 604ms
                 Asset    Size  Chunks             Chunk Names
    server-bundle.json  112 kB          [emitted]  

  console.log node_modules/nuxt/lib/core/nuxt.js:126

     OPEN  http://localhost:5060


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @nuxtjs/google[email protected]2.0.2 test: `npm run lint && jest`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @nuxtjs/[email protected]2.0.2 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sobolev/.npm/_logs/2018-05-15T11_40_40_668Z-debug.log

Additional comments?

My env:

  • Node: v9.4.0
  • Npm: 5.6.0
sobolevn

sobolevn posted a new question

analytics-module β€’ 3 months ago

npm run test does not work

Steps to reproduce

  1. git clone this repo
  2. npm i
  3. npm test

Env

Node: v9.4.0
Npm: 5.6.0

Output

Β» npm run test

> @nuxtjs/[email protected]2.0.2 test /Users/sobolev/Desktop/analytics-module
> npm run lint && jest


> @nuxtjs/[email protected]2.0.2 lint /Users/sobolev/Desktop/analytics-module
> eslint lib src test

  console.error node_modules/nuxt/lib/core/nuxt.js:166
    Error: [nuxt] Module undefined should export a function
        at ModuleContainer.addModule (/Users/sobolev/Desktop/analytics-module/node_modules/nuxt/lib/core/module.js:113:13)
        at promise.then (/Users/sobolev/Desktop/analytics-module/node_modules/nuxt/lib/common/utils.js:61:61)
        at <anonymous>
        at process._tickCallback (internal/process/next_tick.js:160:7)

Build completed in 12.375s% 

  console.log node_modules/progress-bar-webpack-plugin/node_modules/progress/lib/node-progress.js:179


  console.log node_modules/progress-bar-webpack-plugin/node_modules/progress/lib/node-progress.js:179


  console.log node_modules/friendly-errors-webpack-plugin/src/output.js:81



























  console.log node_modules/friendly-errors-webpack-plugin/src/output.js:103
     DONE  Compiled successfully in 12379ms                               2:40:38 PM

  console.log node_modules/friendly-errors-webpack-plugin/src/output.js:103


  console.log node_modules/nuxt/lib/builder/builder.js:485
    Hash: 129f262eedf51f4aaa86
    Version: webpack 3.12.0
    Time: 12379ms
                                      Asset       Size  Chunks             Chunk Names
        pages/index.d1944e94f3fa94fff074.js  410 bytes       0  [emitted]  pages/index
    layouts/default.cc1854ad9412fd1849aa.js  326 bytes       1  [emitted]  layouts/default
             vendor.a6e76812813970cf0d37.js     144 kB       2  [emitted]  vendor
                app.07d83a8721058ce9e65d.js      26 kB       3  [emitted]  app
           manifest.129f262eedf51f4aaa86.js    1.47 kB       4  [emitted]  manifest
                                   LICENSES  584 bytes          [emitted]  
     + 3 hidden assets

 FAIL  test/module.test.js (17.236s)
  Module
    βœ• render (30ms)

  ● Module β€Ί render

    StatusCodeError: 404 - "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<title>Error</title>\n</head>\n<body>\n<pre>Cannot GET /</pre>\n</body>\n</html>\n"

      at new StatusCodeError (node_modules/request-promise-core/lib/errors.js:32:15)
      at Request.plumbing.callback (node_modules/request-promise-core/lib/plumbing.js:104:33)
      at Request.RP$callback [as _callback] (node_modules/request-promise-core/lib/plumbing.js:46:31)
      at Request.self.callback (node_modules/request/request.js:186:22)
      at Request.<anonymous> (node_modules/request/request.js:1163:10)
      at IncomingMessage.<anonymous> (node_modules/request/request.js:1085:12)

----------|----------|----------|----------|----------|-------------------|
File      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files |        0 |        0 |        0 |        0 |                   |
----------|----------|----------|----------|----------|-------------------|
Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 total
Snapshots:   0 total
Time:        17.878s
Ran all test suites.
  console.log node_modules/nuxt/lib/builder/builder.js:485
    Hash: 0b33a0986a0638a57d72
    Version: webpack 3.12.0
    Time: 604ms
                 Asset    Size  Chunks             Chunk Names
    server-bundle.json  112 kB          [emitted]  

  console.log node_modules/nuxt/lib/core/nuxt.js:126

     OPEN  http://localhost:5060


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @nuxtjs/google[email protected]2.0.2 test: `npm run lint && jest`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @nuxtjs/[email protected]2.0.2 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sobolev/.npm/_logs/2018-05-15T11_40_40_668Z-debug.log
metalanti

metalanti posted a new question

analytics-module β€’ 4 months ago

Use on SSR

can I use this module during SSR?
how can I trigger GA events from the server side?
eg: set the userId, or addImpression for ecommerce on a list of products.
or where should I take those codes? :)
thanks

kieusonlam

kieusonlam posted a new question

analytics-module β€’ 4 months ago

Same web property ID is tracked twice

I got Same web property ID is tracked twice on root url.

image

There is someone have the same problem?

ggirodda

ggirodda posted a new question

analytics-module β€’ 4 months ago

Dynamic id

Hello,
How can I put id dynamically ? I use a custom api module wich retrive some information such as the google analytics id, but it is called in a middleware.
I see that in vue-analytics I can put a Promise instead of the id, but I just want to take the id in my store, I don't want to perform another request, because requests have to be done through the plugin I created, and because I already do that for verification pourpose in the middleware
I try to do that, but google tag assistant doesn't see th UA code:
nuxt.config.js

{src: '~/plugins/vue-analytics.js', ssr: false},

/plugins/vue-analytics.js

import Vue from 'vue'
import VueAnalytics from 'vue-analytics'

export default ({ store }) => {
  Vue.use(VueAnalytics, {
    id: store.state.descs.google_analytics,
    ecommerce: {
      enabled: true
    }
  })
}
stuartjnelson

stuartjnelson posted a new question

analytics-module β€’ 5 months ago

Can't load tracking code ID as enviroment variables

I was hoping to be able to load my tracking code as an environment variable. It seems that the variables on production aren't loaded before the module is initialised. I am deploying with Netlify so I don't know if it's there issue…

IN this screenshot I am logging;

  • Current enviroment
  • The tracking code ID from my .env.production
  • GA debugging is enabled and you can see it's using my development/fallback ID UA-000000-1

screen shot 2018-03-24 at 21 05 11

Steve525

Steve525 posted a new question

analytics-module β€’ 5 months ago

How can you access this module from `context.app` in plugins?

I'm wondering if it's possible to access this module from the context.app object passed in on plugin initialization. Not seeing it present.

robyedlin

robyedlin posted a new question

analytics-module β€’ 6 months ago

Need ability to disable in development

I don't see a config to disable this module in development. Current workaround is to set the env var as UA-000000-1, but this is not ideal.

With missing GA code, the following error returns in development:

client.js:533 [nuxt] Error while initializing app Error: [vue-analytics] Please enter a Google Analytics tracking ID
    at A (http://localhost:3000/_nuxt/vendor.js:19078:4201)
    at I (http://localhost:3000/_nuxt/vendor.js:19078:5605)
    at Function.Vue.use (http://localhost:3000/_nuxt/vendor.js:28179:14)
    at _callee$ (http://localhost:3000/_nuxt/app.js:1270:58)
    at tryCatch (http://localhost:3000/_nuxt/vendor.js:2017:40)
    at Generator.invoke [as _invoke] (http://localhost:3000/_nuxt/vendor.js:2251:22)
    at Generator.prototype.(anonymous function) [as next] (http://localhost:3000/_nuxt/vendor.js:2069:21)
    at step (http://localhost:3000/_nuxt/vendor.js:1832:30)
    at http://localhost:3000/_nuxt/vendor.js:1850:14
    at new Promise (<anonymous>)
ndro

ndro posted a new question

analytics-module β€’ 6 months ago

Migrate from analytics.js to gtag.js

Hi,

We know that google migrate implementation analytics from analytics.js to gtag.js (src: https://developers.google.com/analytics/devguides/collection/gtagjs/migration).

So is this module support to gtag.js?

Because this module is using vue-analytics and in this issue, MatteoGabriele said that vue-analytics didn't yet support gtag.js.

Or, is there any solution to implementing "new" google analytics with gtag.js?

thanks

cbodin

cbodin posted a new question

analytics-module β€’ 6 months ago

Timing issue with vue-meta

pageviewTemplate is resolved before vue-meta has synced the page components head.

Reproduce:

  1. Download Nuxt.js starter template
  2. Install analytics module and set pageviewTemplate:
// nuxt.config.js
'google-analytics': {
  id: 'UA-XXXXXX',
  debug: {
    enabled: true,
  },
  autoTracking: {
    pageviewTemplate: route => {
      return {
        page: route.path,
        title: document.title,
        location: window.location.href,
      };
    },
  },
},
  1. Setup two pages:
<!-- pages/page1.vue -->
<template>
  <div>
    <h1 class="title">Page 1</h1>

    <div class="links">
      <nuxt-link to="page1">Page 1</nuxt-link>
      <nuxt-link to="page2">Page 2</nuxt-link>
    </div>
  </div>
</template>

<script>
export default {
  head() {
    return {
      title: 'Page 1',
    };
  },
}
</script>
<!-- pages/page2.vue -->
<template>
  <div>
    <h1 class="title">Page 2</h1>

    <div class="links">
      <nuxt-link to="page1">Page 1</nuxt-link>
      <nuxt-link to="page2">Page 2</nuxt-link>
    </div>
  </div>
</template>

<script>
export default {
  head() {
    return {
      title: 'Page 2',
    };
  },
}
</script>

Expected behavior:
Page 1 will track "Page 1" as title
Page 2 will track "Page 2" as title

Actual behavior:
Page 1 & Page 2 tracks title correctly during initial load
Page 2 tracks "Page 1" when changing route from Page 1 -> Page 2
Page 1 tracks "Page 2" when changing route from Page 2 -> Page 1

Console output:

location         (&dl)   http://localhost:3000/page2
page             (&dp)   /page2
title            (&dt)   Page 1
location         (&dl)   http://localhost:3000/page1
page             (&dp)   /page1
title            (&dt)   Page 2
jericopulvera

jericopulvera posted a new question

analytics-module β€’ 6 months ago

How do you even start this?

followed the instructions and this happens.

I also did npm install vue-analytics

ERROR Nuxt error

Error: Cannot resolve "@nuxtjs/google-analytics" from "/home/jerico/public_html/jerico.xyz/client/nuxtjs/google-analytics"

  • nuxt.js:220 Nuxt.resolvePath
    [jerico.xyz]/[nuxt]/lib/core/nuxt.js:220:11

  • module.js:114 ModuleContainer.addModule
    [jerico.xyz]/[nuxt]/lib/core/module.js:114:35

  • utils.js:96 promise.then
    [jerico.xyz]/[nuxt]/lib/common/utils.js:96:43

  • nexttick.js:188 process.tickCallback
    internal/process/next_tick.js:188:7

  • module.js:686 Function.Module.runMain
    module.js:686:11

  • bootstrapnode.js:187 startup bootstrapnode.js:187:16

  • bootstrap_node.js:608

nirvanagit

nirvanagit posted a new question

analytics-module β€’ 9 months ago

Cannot install via npm
npm i @nuxtjs/google-analytics
npm WARN package.json [email protected]1.4.1 assert is also the name of a node core module.
npm WARN package.json [email protected]4.9.1 buffer is also the name of a node core module.
npm WARN package.json [email protected]1.1.1 events is also the name of a node core module.
npm WARN package.json [email protected]0.0.1 No repository field.
npm WARN package.json [email protected]6.0.0 scripts['tests'] should probably be scripts['test'].
npm WARN package.json [email protected]7.2.1 scripts['tests'] should probably be scripts['test'].
npm WARN package.json [email protected]1.4.1 punycode is also the name of a node core module.
npm WARN package.json [email protected]0.2.0 querystring is also the name of a node core module.
npm WARN package.json [email protected]1.0.3 string_decoder is also the name of a node core module.
npm WARN package.json [email protected]0.11.0 url is also the name of a node core module.
npm WARN package.json [email protected]0.10.3 util is also the name of a node core module.
npm WARN package.json [email protected]1.6.0 No repository field.
npm ERR! 404 Not Found
npm ERR! 404
npm ERR! 404 'nuxtjs/google-analytics' is not in the npm registry.
cryptomaniac512

cryptomaniac512 posted a new question

analytics-module β€’ 10 months ago

Run only in production mode

Can you provide some option or disable it by default for non-production mode?