This repository has been archived by the owner on Jun 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #61 from MatteoGabriele/develop
feat(script-loader): add optional analytics script tag check
- Loading branch information
Showing
6 changed files
with
86 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
## How to load Google Analytics script | ||
|
||
By default nothing is needed: the plugin does everything for you! | ||
|
||
However, in some cases, you might want to avoid auto-loading the analytics.js script because: | ||
- maybe the framework you're using already does it for you | ||
- you really can't remove it from your project | ||
- other issue that I can't come up with | ||
|
||
So for all those cases it is possible to let the plugin detect if an analytics script has been added already in your html | ||
|
||
```js | ||
import Vue from 'vue' | ||
import VueAnalytics from 'vue-analytics' | ||
|
||
Vue.use(VueAnalytics, { | ||
id: 'UA-XXX-X', | ||
checkDuplicatedScript: true | ||
}) | ||
``` | ||
|
||
or just disable the script loader | ||
|
||
```js | ||
import Vue from 'vue' | ||
import VueAnalytics from 'vue-analytics' | ||
|
||
Vue.use(VueAnalytics, { | ||
id: 'UA-XXX-X', | ||
disableScriptLoader: true | ||
}) | ||
``` | ||
|
||
### Important | ||
It is not possible for the plugin to remove the initial trackers, because it needs them to create all methods for the multi-tracking feature. | ||
**If you can't remove initial trackers, don't use this plugin: the outcome could be unpredictable.** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters