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

chore(deps-dev): bump vue-template-compiler from 2.6.12 to 2.6.14 #1

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
496598f
fix(query): window[globalObjectName] is undefined (#309)
MatteoGabriele May 4, 2021
7785f8a
chore: upgrade CI node version (#300)
MatteoGabriele May 4, 2021
980b4bf
chore(deps): bump lodash from 4.17.15 to 4.17.21 (#283)
dependabot[bot] May 5, 2021
0103b79
chore(deps): bump y18n from 3.2.1 to 3.2.2 (#281)
dependabot[bot] May 6, 2021
000cfd8
chore(deps): bump ini from 1.3.5 to 1.3.8 (#271)
dependabot[bot] May 6, 2021
627159f
chore(deps-dev): bump eslint-plugin-vue from 6.2.2 to 7.9.0 (#304)
dependabot[bot] May 6, 2021
fe1a2ce
Create FUNDING.yml
MatteoGabriele May 7, 2021
99397ba
Delete FUNDING.yml
MatteoGabriele May 7, 2021
f017735
chore(deps-dev): bump eslint-plugin-jest from 23.20.0 to 24.3.6 (#303)
dependabot[bot] May 7, 2021
56c9a4d
refactor: migrate to vue 3 (#311)
MatteoGabriele May 8, 2021
98ddfc0
doc: update
MatteoGabriele May 8, 2021
3b49962
chore: add release branch and tag
MatteoGabriele May 9, 2021
59b89ec
doc: update
MatteoGabriele May 9, 2021
218cabc
Update README.md
MatteoGabriele May 9, 2021
73706f1
Update README.md
MatteoGabriele May 9, 2021
56e49b9
Update README.md
MatteoGabriele May 9, 2021
8788664
chore(deps): bump handlebars from 4.7.6 to 4.7.7 (#312)
dependabot[bot] May 12, 2021
8c2e395
fix(vue-gtag.d.ts): typescript types & deduping utils.js (#315)
based-ghost May 21, 2021
74344f1
chore(deps-dev): bump eslint-plugin-vue from 7.9.0 to 7.15.0 (#357)
dependabot[bot] Aug 21, 2021
0564e45
chore(deps-dev): bump @babel/preset-env from 7.14.0 to 7.14.8 (#359)
dependabot[bot] Aug 21, 2021
5da18d6
chore(deps-dev): bump vue-template-compiler from 2.6.12 to 2.6.14
dependabot[bot] Feb 2, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .babelrc

This file was deleted.

12 changes: 6 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
dependencies:
docker:
- image: circleci/node:10.16.3
- image: circleci/node:12.18.1
steps:
- checkout
- restore_cache:
Expand All @@ -16,7 +16,7 @@ jobs:
- ./node_modules
test:
docker:
- image: circleci/node:10.16.3
- image: circleci/node:12.18.1
steps:
- checkout
- restore_cache:
Expand All @@ -26,7 +26,7 @@ jobs:

lint:
docker:
- image: circleci/node:10.16.3
- image: circleci/node:12.18.1
steps:
- checkout
- restore_cache:
Expand All @@ -36,7 +36,7 @@ jobs:

code_climate:
docker:
- image: circleci/node:10.16.3
- image: circleci/node:12.18.1
steps:
- checkout
- restore_cache:
Expand All @@ -51,7 +51,7 @@ jobs:

build:
docker:
- image: circleci/node:10.16.3
- image: circleci/node:12.18.1
steps:
- checkout
- restore_cache:
Expand All @@ -61,7 +61,7 @@ jobs:

semantic_release:
docker:
- image: circleci/node:10.16.3
- image: circleci/node:12.18.1
steps:
- checkout
- restore_cache:
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
🔥 **HEADS UP!** This is version 2 branch and it requires Vue 3. If you are looking for a Vue 2 compatible version, use [version 1](https://github.com/MatteoGabriele/vue-gtag/tree/1.0). You can find both documentations [here](https://matteo-gabriele.gitbook.io/vue-gtag/)


<p align="center">
<img width="250" src="https://i.imgur.com/AlAf04U.png">
<br>
Expand Down Expand Up @@ -27,18 +30,14 @@ Global Site Tag plugin for Vue

The global site tag (gtag.js) is a JavaScript tagging framework and API that allows you to send event data to Google Analytics, Google Ads, and Google Marketing Platform. For general gtag.js [documentation](https://developers.google.com/analytics/devguides/collection/gtagjs), read the gtag.js developer guide.

## Vue 3 update
Released Vue 3 compatible version on this new repo https://github.com/MatteoGabriele/vue-gtag-next and you can install the package under `vue-gtag-next`. I will release it under the `vue-gtag` package once Vue will officially release version 3 as latest version.
If you have any feedback, please consider opening an issue on https://github.com/MatteoGabriele/vue-gtag-next/issues :pray:

## Requirements

Vue ^2.0.0
Vue ^3.0.0

## Install

```bash
npm install vue-gtag
npm install vue-gtag@next
```

## Documentation
Expand Down
3 changes: 3 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: ["@babel/preset-env"],
};
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
"type": "git",
"url": "https://github.com/MatteoGabriele/vue-gtag"
},
"release": {
"branches": ["master", "next"]
},
"scripts": {
"commit": "git-cz",
"clean": "del-cli dist",
Expand Down Expand Up @@ -79,12 +82,11 @@
},
"homepage": "https://github.com/MatteoGabriele/vue-gtag#readme",
"peerDependencies": {
"vue": "^2.0.0"
"vue": "^3.0.0"
},
"devDependencies": {
"@babel/core": "^7.7.2",
"@babel/preset-env": "^7.7.1",
"@vue/test-utils": "^1.0.0-beta.29",
"babel-eslint": "^10.0.3",
"bili": "^5.0.5",
"commitizen": "^4.0.3",
Expand All @@ -93,9 +95,9 @@
"del-cli": "^3.0.0",
"eslint": "^6.6.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-jest": "^23.0.4",
"eslint-plugin-jest": "^24.3.6",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-vue": "^6.0.1",
"eslint-plugin-vue": "^7.9.0",
"flush-promises": "^1.0.2",
"jest": "^26.0.1",
"jest-extended": "^0.11.5",
Expand All @@ -105,8 +107,8 @@
"rollup-plugin-alias": "^2.2.0",
"rollup-plugin-resolve": "^0.0.1-predev.1",
"semantic-release": "^15.13.31",
"vue": "^2.6.12",
"vue-router": "^3.1.3",
"vue": "^3.0.0",
"vue-router": "^4.0.6",
"vue-template-compiler": "^2.6.10"
}
}
18 changes: 9 additions & 9 deletions src/add-routes-tracker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Vue from "vue";
import { isFn } from "@/utils";
import { nextTick } from "vue";
import { isFunction } from "@vue/shared";
import { getRouter } from "@/router";
import { getOptions } from "@/options";
import addConfiguration from "@/add-configuration";
Expand All @@ -14,32 +14,32 @@ export default () => {
const { onBeforeTrack, onAfterTrack } = getOptions();
const router = getRouter();

router.onReady(() => {
Vue.nextTick().then(() => {
router.isReady().then(() => {
nextTick().then(() => {
const { currentRoute } = router;

addConfiguration();

if (isRouteExcluded(currentRoute)) {
if (isRouteExcluded(currentRoute.value)) {
return;
}

track(currentRoute);
track(currentRoute.value);
});

router.afterEach((to, from) => {
Vue.nextTick().then(() => {
nextTick().then(() => {
if (isRouteExcluded(to)) {
return;
}

if (isFn(onBeforeTrack)) {
if (isFunction(onBeforeTrack)) {
onBeforeTrack(to, from);
}

track(to, from);

if (isFn(onAfterTrack)) {
if (isFunction(onAfterTrack)) {
onAfterTrack(to, from);
}
});
Expand Down
6 changes: 3 additions & 3 deletions src/api/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { getOptions } from "@/options";
import { isBrowser } from "@/utils";

export default (...args) => {
if (!isBrowser()) {
const { globalObjectName } = getOptions();

if (!isBrowser() || typeof window[globalObjectName] === "undefined") {
return;
}

const { globalObjectName } = getOptions();

window[globalObjectName](...args);
};
4 changes: 3 additions & 1 deletion src/attach-api.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import * as api from "@/api";

const attachApi = (Vue) => (Vue.$gtag = Vue.prototype.$gtag = api);
const attachApi = (app) => {
app.config.globalProperties.$gtag = api;
};

export default attachApi;
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { setOptions, getOptions } from "@/options";
import bootstrap from "@/bootstrap";
import { setRouter } from "@/router";

const install = (Vue, options = {}, router) => {
attachApi(Vue);
const install = (app, options = {}, router) => {
attachApi(app);
setOptions(options);
setRouter(router);

Expand Down
5 changes: 3 additions & 2 deletions src/track.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { isFunction } from "@vue/shared";
import { getOptions } from "@/options";
import { validateScreenviewShape, isFn } from "@/utils";
import { validateScreenviewShape } from "@/utils";
import * as api from "@/api";

export default (to = {}, from = {}) => {
Expand All @@ -16,7 +17,7 @@ export default (to = {}, from = {}) => {

let template = to;

if (isFn(proxy)) {
if (isFunction(proxy)) {
template = proxy(to, from);
} else if (useScreenview) {
template = validateScreenviewShape({
Expand Down
12 changes: 4 additions & 8 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { isPlainObject } from "@vue/shared";

export const load = (url, options = {}) => {
return new Promise((resolve, reject) => {
if (typeof document === "undefined") {
Expand Down Expand Up @@ -27,25 +29,19 @@ export const load = (url, options = {}) => {
});
};

export const isFn = (fn) => typeof fn === "function";

export const isObject = (item) => {
return item && typeof item === "object" && !Array.isArray(item);
};

export const mergeDeep = (target, ...sources) => {
if (!sources.length) {
return target;
}

const source = sources.shift();

if (!isObject(target) || !isObject(source)) {
if (!isPlainObject(target) || !isPlainObject(source)) {
return;
}

for (const key in source) {
if (isObject(source[key])) {
if (isPlainObject(source[key])) {
if (!target[key]) {
Object.assign(target, { [key]: {} });
}
Expand Down
6 changes: 0 additions & 6 deletions test/__mocks__/vue/index.js

This file was deleted.

10 changes: 5 additions & 5 deletions test/add-configuration.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createLocalVue } from "@vue/test-utils";
import { createApp } from "vue";
import VueGtag from "@/index";
import * as api from "@/api";

Expand All @@ -10,9 +10,9 @@ describe("add-configuration", () => {
});

test("fires a configuration for the main domain", () => {
const localVue = createLocalVue();
const app = createApp();

localVue.use(VueGtag, {
app.use(VueGtag, {
config: {
id: 1,
},
Expand All @@ -25,9 +25,9 @@ describe("add-configuration", () => {
});

test("fires a configuration for multiple domains", () => {
const localVue = createLocalVue();
const app = createApp();

localVue.use(VueGtag, {
app.use(VueGtag, {
includes: [
{
id: 2,
Expand Down
Loading