├── .circleci └── config.yml ├── .codeclimate.yml ├── .dependabot └── config.yml ├── .eslintrc.js ├── .gitignore ├── ISSUE_TEMPLATE.md ├── LICENSE ├── README.md ├── __tests__ ├── __snapshots__ │ ├── register-global-object.spec.js.snap │ ├── router-state.spec.js.snap │ ├── state.spec.js.snap │ └── utils.spec.js.snap ├── api │ ├── __snapshots__ │ │ ├── index.spec.js.snap │ │ └── use-gtag.spec.js.snap │ ├── config.spec.js │ ├── custom-map.spec.js │ ├── disable.spec.js │ ├── event.spec.js │ ├── exception.spec.js │ ├── index.spec.js │ ├── linker.spec.js │ ├── pageview.spec.js │ ├── purchase.spec.js │ ├── query.spec.js │ ├── refund.spec.js │ ├── screenview.spec.js │ ├── set.spec.js │ ├── time.spec.js │ └── use-gtag.spec.js ├── bootstrap.spec.js ├── index.spec.js ├── page-tracker.spec.js ├── register-global-object.spec.js ├── router-state.spec.js ├── state.spec.js └── utils.spec.js ├── babel.config.js ├── bili.config.js ├── package.json ├── src ├── api │ ├── config.js │ ├── custom-map.js │ ├── disable.js │ ├── event.js │ ├── exception.js │ ├── index.js │ ├── linker.js │ ├── pageview.js │ ├── purchase.js │ ├── query.js │ ├── refund.js │ ├── screenview.js │ ├── set.js │ ├── time.js │ └── use-gtag.js ├── bootstrap.js ├── index.js ├── page-tracker.js ├── register-global-object.js ├── router-state.js ├── state.js └── utils.js ├── vue-gtag-next.d.ts └── yarn.lock /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | 3 | jobs: 4 | dependencies: 5 | docker: 6 | - image: circleci/node:10.16.3 7 | steps: 8 | - checkout 9 | - restore_cache: 10 | key: v1-yarn-{{ checksum "yarn.lock" }} 11 | - run: 12 | command: yarn 13 | - save_cache: 14 | key: v1-yarn-{{ checksum "yarn.lock" }} 15 | paths: 16 | - ./node_modules 17 | test: 18 | docker: 19 | - image: circleci/node:10.16.3 20 | steps: 21 | - checkout 22 | - restore_cache: 23 | key: v1-yarn-{{ checksum "yarn.lock" }} 24 | - run: 25 | command: yarn test 26 | 27 | lint: 28 | docker: 29 | - image: circleci/node:10.16.3 30 | steps: 31 | - checkout 32 | - restore_cache: 33 | key: v1-yarn-{{ checksum "yarn.lock" }} 34 | - run: 35 | command: yarn lint 36 | 37 | code_climate: 38 | docker: 39 | - image: circleci/node:10.16.3 40 | steps: 41 | - checkout 42 | - restore_cache: 43 | key: v1-yarn-{{ checksum "yarn.lock" }} 44 | - run: 45 | command: | 46 | curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter 47 | chmod +x ./cc-test-reporter 48 | ./cc-test-reporter before-build 49 | yarn coverage:lcov 50 | ./cc-test-reporter after-build 51 | 52 | build: 53 | docker: 54 | - image: circleci/node:10.16.3 55 | steps: 56 | - checkout 57 | - restore_cache: 58 | key: v1-yarn-{{ checksum "yarn.lock" }} 59 | - run: 60 | command: yarn build 61 | 62 | semantic_release: 63 | docker: 64 | - image: circleci/node:10.16.3 65 | steps: 66 | - checkout 67 | - restore_cache: 68 | key: v1-yarn-{{ checksum "yarn.lock" }} 69 | - run: yarn semantic-release 70 | 71 | 72 | workflows: 73 | version: 2 74 | workflow: 75 | jobs: 76 | - dependencies 77 | 78 | - lint: 79 | requires: 80 | - dependencies 81 | 82 | - test: 83 | requires: 84 | - dependencies 85 | 86 | - code_climate: 87 | filters: 88 | branches: 89 | only: 90 | - master 91 | requires: 92 | - test 93 | - lint 94 | 95 | - build: 96 | requires: 97 | - test 98 | - lint 99 | - code_climate 100 | 101 | - semantic_release: 102 | filters: 103 | branches: 104 | only: 105 | - master 106 | requires: 107 | - build 108 | 109 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | exclude_patterns: 2 | - "__tests__" 3 | - "!src/**/*" 4 | - "webpack.config.js" -------------------------------------------------------------------------------- /.dependabot/config.yml: -------------------------------------------------------------------------------- 1 | version: 1 2 | update_configs: 3 | - package_manager: "javascript" 4 | directory: "/" 5 | update_schedule: "monthly" -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true, 5 | "jest/globals": true 6 | }, 7 | plugins: [ 8 | "jest" 9 | ], 10 | extends: [ 11 | "eslint:recommended", 12 | "plugin:vue/recommended", 13 | "prettier/vue", 14 | "plugin:prettier/recommended" 15 | ], 16 | parserOptions: { 17 | parser: "babel-eslint" 18 | } 19 | }; -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | node_modules/ 3 | .DS_Store 4 | npm-debug.log 5 | yarn-error.log 6 | coverage/ -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | If you are reporting a bug, please fill in below. Otherwise feel free to remove this template entirely. 2 | 3 | ### Description 4 | 5 | What are you reporting? 6 | 7 | ### Expected behavior 8 | 9 | Tell us what you think should happen. 10 | 11 | ### Actual behavior 12 | 13 | Tell us what actually happens. 14 | 15 | ### Environment 16 | 17 | Run this command in the project folder and fill in their results: 18 | 19 | `npm ls vue-gtag`: 20 | 21 | Then, specify: 22 | 23 | 1. Operating system: 24 | 2. Browser and version: 25 | 26 | ### Reproducible Demo 27 | 28 | Please take the time to create a new app that reproduces the issue or at least some code example 29 | 30 | Demonstrable issues gets fixed faster. 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Matteo Gabriele 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### Please, use vue-gtag v2. 2 | 3 |

4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 |

25 | 26 | # vue-gtag-next 27 | 28 | Global Site Tag plugin for Vue 3 29 | 30 | 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. 31 | 32 | ## Requirements 33 | 34 | Vue ^3.0.0 35 | 36 | ## Install 37 | 38 | ```bash 39 | npm install vue-gtag-next 40 | ``` 41 | 42 | ## Documentation 43 | 44 | - [vue-gtag-next documentation](https://matteo-gabriele.gitbook.io/vue-gtag/v/next/) 45 | - [gtag.js official documentation](https://developers.google.com/analytics/devguides/collection/gtagjs) 46 | 47 | ## Issues and features requests 48 | 49 | Please drop an issue, if you find something that doesn't work, or a feature request at [https://github.com/MatteoGabriele/vue-gtag-next/issues](https://github.com/MatteoGabriele/vue-gtag-next/issues) 50 | 51 | Follow me on twitter [@matteo\_gabriele](https://twitter.com/matteo_gabriele) for updates 52 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/register-global-object.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`register-global-object should push arguments inside the dataLayer 1`] = ` 4 | Array [ 5 | Arguments [ 6 | "js", 7 | 2020-01-01T01:01:01.000Z, 8 | ], 9 | Arguments [ 10 | "foo", 11 | "bar", 12 | ], 13 | ] 14 | `; 15 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/router-state.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`options should render default router state 1`] = ` 4 | Object { 5 | "skipSamePath": true, 6 | "template": null, 7 | "useScreenview": false, 8 | } 9 | `; 10 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/state.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`options should render default plugin state 1`] = ` 4 | Object { 5 | "appId": null, 6 | "appName": null, 7 | "appVersion": null, 8 | "customResource": null, 9 | "dataLayerName": "dataLayer", 10 | "disableScriptLoader": false, 11 | "globalObjectName": "gtag", 12 | "isEnabled": true, 13 | "preconnectOrigin": "https://www.googletagmanager.com", 14 | "property": null, 15 | "resourceURL": "https://www.googletagmanager.com/gtag/js", 16 | "useDebugger": false, 17 | } 18 | `; 19 | -------------------------------------------------------------------------------- /__tests__/__snapshots__/utils.spec.js.snap: -------------------------------------------------------------------------------- 1 | // Jest Snapshot v1, https://goo.gl/fbAQLP 2 | 3 | exports[`loadScript should create a link for domain preconnect 1`] = ` 4 | 5 | 9 |