API
Plugin default state
Default plugin installation properties. All properties can be modified using the useState helper method
Changes to the gtag global namespace can be done only during plugin installation
useState
Type: function
Default value: plugin state
The useState
method returns the plugin default state properties as single ref
. This is useful in case we want to add/edit all plugin options outside the plugin install snippet or if we simply want to retrieve its properties and render them in a template.
trackRouter
Type: function
Using trackRouter, will help you connect the plugin to your VueRouter instance and start tracking page changes automatically. This method accepts the VueRouter instance as first parameter and options as second parameter.
Tracker router default options:
useGtag
Type: function
The useGtag
method returns all vue-gtag methods.
config
event
customMap
disable
exception
linker
pageview
screenview
purchase
query
refund
set
time
If the method you are looking for is not listed here, you can use the query method which directly queries the gtag instance.
it is also possible to simply export the methods from the package itself
isTracking
Type: Boolean
Default value: false
When true
the plugin is able to collect data and push the inside the dataLayer, but it doesn't mean that the gtag.js script is loaded yet.
isReady
Type: Boolean
Default value: false
When true
the plugin is fully bootstrapped: the data is collected and pushed inside the dataLayer and the gtag.js script is fully loaded.
Last updated