Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: nuxt-community/google-analytics-module
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.2.3
Choose a base ref
...
head repository: nuxt-community/google-analytics-module
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.3.0
Choose a head ref
  • 13 commits
  • 17 files changed
  • 4 contributors

Commits on Jan 13, 2020

  1. Copy the full SHA
    e132988 View commit details
  2. Copy the full SHA
    270ad13 View commit details
  3. 2
    Copy the full SHA
    1228474 View commit details
  4. Copy the full SHA
    63e4064 View commit details
  5. Copy the full SHA
    a1170d8 View commit details

Commits on Feb 6, 2020

  1. Copy the full SHA
    536ba09 View commit details

Commits on Feb 21, 2020

  1. chore(deps-dev): bump codecov from 3.6.1 to 3.6.5 (#70)

    Bumps [codecov](https://github.com/codecov/codecov-node) from 3.6.1 to 3.6.5.
    - [Release notes](https://github.com/codecov/codecov-node/releases)
    - [Commits](https://github.com/codecov/codecov-node/commits)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Feb 21, 2020
    Copy the full SHA
    677c302 View commit details

Commits on Mar 17, 2020

  1. chore(deps): bump acorn from 5.7.3 to 5.7.4 (#73)

    Bumps [acorn](https://github.com/acornjs/acorn) from 5.7.3 to 5.7.4.
    - [Release notes](https://github.com/acornjs/acorn/releases)
    - [Commits](acornjs/acorn@5.7.3...5.7.4)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Mar 17, 2020
    Copy the full SHA
    f013cac View commit details

Commits on May 5, 2020

  1. Copy the full SHA
    26293ac View commit details

Commits on May 19, 2020

  1. Copy the full SHA
    a7c61e2 View commit details
  2. Copy the full SHA
    5c75f37 View commit details
  3. test: fix

    ricardogobbosouza committed May 19, 2020
    Copy the full SHA
    ea9eb35 View commit details
  4. Copy the full SHA
    24bf456 View commit details
38 changes: 0 additions & 38 deletions .circleci/config.yml

This file was deleted.

46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: ci

on:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
ci:
runs-on: ${{ matrix.os }}

strategy:
matrix:
# os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
node: [10]

steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}

- name: checkout
uses: actions/checkout@master

- name: cache node_modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ matrix.os }}-node-v${{ matrix.node }}-deps-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn

- name: Lint
run: yarn lint

- name: Test
run: yarn test

- name: Coverage
uses: codecov/codecov-action@v1
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## [2.3.0](https://github.com/nuxt-community/analytics-module/compare/v2.2.3...v2.3.0) (2020-05-19)


### Features

* typescript typings ([#78](https://github.com/nuxt-community/analytics-module/issues/78)) ([5c75f37](https://github.com/nuxt-community/analytics-module/commit/5c75f37ae97d0fa4beb58d9a58befb224b38b2fc))

### [2.2.3](https://github.com/nuxt-community/analytics-module/compare/v2.2.2...v2.2.3) (2020-01-10)

### [2.2.2](https://github.com/nuxt-community/analytics-module/compare/v2.2.1...v2.2.2) (2019-12-03)
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Matteo Gabriele <m.gabriele.dev@gmail.com>
Copyright (c) Nuxt Community

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

[![npm version][npm-version-src]][npm-version-href]
[![npm downloads][npm-downloads-src]][npm-downloads-href]
[![Circle CI][circle-ci-src]][circle-ci-href]
[![Github Actions CI][github-actions-ci-src]][github-actions-ci-href]
[![Codecov][codecov-src]][codecov-href]
[![License][license-src]][license-href]

@@ -20,8 +20,6 @@ yarn add --dev @nuxtjs/google-analytics # or npm install --save-dev @nuxtjs/goog

2. Add `@nuxtjs/google-analytics` to the `buildModules` section of `nuxt.config.js`

:warning: If you are using Nuxt older than **v2.9** you have to install module as a `dependency` (No `--dev` or `--save-dev` flags) and also use `modules` section in `nuxt.config.js` instead of `buildModules`.

```js
export default {
buildModules: [
@@ -32,6 +30,8 @@ export default {
}
```

:warning: If you are using Nuxt **< v2.9** you have to install the module as a `dependency` (No `--dev` or `--save-dev` flags) and use `modules` section in `nuxt.config.js` instead of `buildModules`.

### Using top level options

```js
@@ -47,14 +47,14 @@ export default {

## Usage

Click [here](https://matteogabriele.gitbooks.io/vue-analytics/content/) for all options and features of vue-analytics
Click [here](https://matteogabriele.gitbooks.io/vue-analytics/) for all options and features of vue-analytics

Differences between vue-analytics and the Nuxt.js implementation:

- The router instance is already added out of the box (read [here](https://github.com/MatteoGabriele/vue-analytics/blob/master/docs/page-tracking.md#disable-page-auto-tracking) if you need to disable it)
- The `id` and `ua` properties have the exact same behaviour. The `ua` property has been added for backwards compatibily with previous releases
- You can disable module for `nuxt dev` by setting `dev: false` option in module options
- Note: By default, you won't see hits going out in dev mode. For testing analytics in dev mode, you must add the following to `nuxt.config.js`:
- Note: By default, you won't see hits going out in dev mode. For testing analytics in dev mode, you must add the following to the `googleAnalytics` options in `nuxt.config.js`:

```js
debug: {
@@ -67,20 +67,20 @@ Differences between vue-analytics and the Nuxt.js implementation:

[MIT License](./LICENSE)

Copyright (c) - Matteo Gabriele <m.gabriele.dev@gmail.com>
Copyright (c) Nuxt Community

<!-- Badges -->
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/google-analytics/latest.svg?style=flat-square
[npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/google-analytics/latest.svg
[npm-version-href]: https://npmjs.com/package/@nuxtjs/google-analytics

[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/google-analytics.svg?style=flat-square
[npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/google-analytics.svg
[npm-downloads-href]: https://npmjs.com/package/@nuxtjs/google-analytics

[circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/analytics-module.svg?style=flat-square
[circle-ci-href]: https://circleci.com/gh/nuxt-community/analytics-module
[github-actions-ci-src]: https://github.com/nuxt-community/analytics-module/workflows/ci/badge.svg
[github-actions-ci-href]: https://github.com/nuxt-community/analytics-module/actions?query=workflow%3Aci

[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/analytics-module.svg?style=flat-square
[codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/analytics-module.svg
[codecov-href]: https://codecov.io/gh/nuxt-community/analytics-module

[license-src]: https://img.shields.io/npm/l/@nuxtjs/google-analytics.svg?style=flat-square
[license-src]: https://img.shields.io/npm/l/@nuxtjs/google-analytics.svg
[license-href]: https://npmjs.com/package/@nuxtjs/google-analytics
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
{
"name": "@nuxtjs/google-analytics",
"version": "2.2.3",
"version": "2.3.0",
"description": "Google Analytics Module for Nuxt.js",
"repository": "https://github.com/nuxt-community/analytics-module",
"repository": "nuxt-community/analytics-module",
"license": "MIT",
"contributors": [
"Matteo Gabriele <m.gabriele.dev@gmail.com>"
"Matteo Gabriele <m.gabriele.dev@gmail.com>",
"Ricardo Gobbo de Souza <ricardogobbosouza@yahoo.com.br>"
],
"main": "lib/module.js",
"types": "types/index.d.ts",
"files": [
"lib"
"lib",
"types/*.d.ts"
],
"main": "lib/module.js",
"scripts": {
"lint": "eslint --ext .js,.vue .",
"release": "yarn test && standard-version && git push --follow-tags && npm publish",
@@ -24,7 +27,6 @@
"@commitlint/config-conventional": "latest",
"@nuxtjs/eslint-config": "latest",
"@nuxtjs/module-test-utils": "latest",
"codecov": "latest",
"eslint": "latest",
"husky": "latest",
"jest": "latest",
9 changes: 2 additions & 7 deletions test/dev.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { setup, loadConfig, get, url } = require('@nuxtjs/module-test-utils')
const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils')

describe('dev', () => {
let nuxt, addTemplate
@@ -9,7 +9,7 @@ describe('dev', () => {
nuxt.moduleContainer.addTemplate
)
}
({ nuxt } = (await setup(loadConfig(__dirname, 'dev'), { waitFor: 2000, beforeNuxtReady })))
({ nuxt } = (await setup(loadConfig(__dirname, 'dev'), { beforeNuxtReady })))
}, 60000)

afterAll(async () => {
@@ -21,11 +21,6 @@ describe('dev', () => {
expect(html).toContain('Works!')
})

test('$ga should be defined', async () => {
const window = await nuxt.renderAndGetWindow(url('/'))
expect(window.$nuxt.$ga).toBeDefined()
})

test('option id', () => {
expect(addTemplate).toBeDefined()
const call = addTemplate.mock.calls.find(args => args[0].src.includes('plugin.js'))
9 changes: 2 additions & 7 deletions test/disabled-send-hit-task.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { setup, loadConfig, get, url } = require('@nuxtjs/module-test-utils')
const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils')

describe('disabled sendHitTask', () => {
let nuxt, addTemplate
@@ -9,7 +9,7 @@ describe('disabled sendHitTask', () => {
nuxt.moduleContainer.addTemplate
)
}
({ nuxt } = (await setup(loadConfig(__dirname, 'disabled-send-hit-task'), { waitFor: 2000, beforeNuxtReady })))
({ nuxt } = (await setup(loadConfig(__dirname, 'disabled-send-hit-task'), { beforeNuxtReady })))
}, 60000)

afterAll(async () => {
@@ -21,11 +21,6 @@ describe('disabled sendHitTask', () => {
expect(html).toContain('Works!')
})

test('$ga should be defined', async () => {
const window = await nuxt.renderAndGetWindow(url('/'))
expect(window.$nuxt.$ga).toBeDefined()
})

test('sendHitTask should be false', () => {
expect(addTemplate).toBeDefined()
const call = addTemplate.mock.calls.find(args => args[0].src.includes('plugin.js'))
9 changes: 2 additions & 7 deletions test/disabled.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { setup, loadConfig, get, url } = require('@nuxtjs/module-test-utils')
const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils')

describe('disabled', () => {
let nuxt, addTemplate
@@ -9,7 +9,7 @@ describe('disabled', () => {
nuxt.moduleContainer.addTemplate
)
}
({ nuxt } = (await setup(loadConfig(__dirname, 'disabled'), { waitFor: 2000, beforeNuxtReady })))
({ nuxt } = (await setup(loadConfig(__dirname, 'disabled'), { beforeNuxtReady })))
}, 60000)

afterAll(async () => {
@@ -21,11 +21,6 @@ describe('disabled', () => {
expect(html).toContain('Works!')
})

test('$ga should be undefined', async () => {
const window = await nuxt.renderAndGetWindow(url('/'))
expect(window.$nuxt.$ga).toBeUndefined()
})

test('plugin should be undefined', () => {
expect(addTemplate).toBeDefined()
const call = addTemplate.mock.calls.find(args => args[0].src.includes('plugin.js'))
3 changes: 0 additions & 3 deletions test/fixture/dev/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module.exports = {
dev: true,
rootDir: __dirname,
render: {
resourceHints: false
},
buildModules: [
{ handler: require('../../../') }
],
3 changes: 0 additions & 3 deletions test/fixture/disabled-send-hit-task/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module.exports = {
dev: true,
rootDir: __dirname,
render: {
resourceHints: false
},
buildModules: [
{ handler: require('../../../') }
],
3 changes: 0 additions & 3 deletions test/fixture/disabled/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module.exports = {
dev: true,
rootDir: __dirname,
render: {
resourceHints: false
},
buildModules: [
{ handler: require('../../../') }
],
3 changes: 0 additions & 3 deletions test/fixture/options/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module.exports = {
rootDir: __dirname,
render: {
resourceHints: false
},
buildModules: [
{ handler: require('../../../') }
],
3 changes: 0 additions & 3 deletions test/fixture/prod/nuxt.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
module.exports = {
rootDir: __dirname,
render: {
resourceHints: false
},
buildModules: [
{ handler: require('../../../') }
],
33 changes: 33 additions & 0 deletions types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type Vue from 'vue'
import type { default as VueAnalytics, InstallOptions } from 'vue-analytics'
import './vuex'

declare module '@nuxt/vue-app' {
interface Context {
$ga: VueAnalytics
}
interface NuxtAppOptions {
$ga: VueAnalytics
}
}

// Nuxt 2.9+
declare module '@nuxt/types' {
interface Context {
$ga: VueAnalytics
}

interface NuxtAppOptions {
$ga: VueAnalytics
}

interface Configuration {
googleAnalytics?: InstallOptions
}
}

declare module 'vue/types/vue' {
interface Vue {
$ga: VueAnalytics
}
}
7 changes: 7 additions & 0 deletions types/vuex.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type VueAnalytics from 'vue-analytics'

declare module 'vuex' {
interface Store<S> {
$ga: VueAnalytics,
}
}
Loading