Nuxt
- 1 Minute to read
- Print
- DarkLight
Nuxt
- 1 Minute to read
- Print
- DarkLight
Article summary
Did you find this summary helpful?
Thank you for your feedback
To track your Nuxt app, first go to your Nuxt project directory and install the package:
$ npm install --save @webtrekk-smart-pixel/vue
Then create a js file like webtrekk.js
in the plugin
directory:
import WebtrekkSmartpixelVue from "@webtrekk-smart-pixel/vue";
import Vue from "vue";
export default () => {
const webtrekkConfig = {
trackId: "111111111111111",
trackDomain: "analytics01.wt-eu02.net",
activateLinkTracking: true,
activateAutoTracking: true,
activateTeaserTracking: true,
activateProductListTracking: true,
activateContentEngagement: true
};
Vue.use(WebtrekkSmartpixelVue, webtrekkConfig);
};
Next, go to your nuxt.config.js
file and add this file to the plugin array:
/**
* Plugins to load before mounting the App
*/
plugins: ["~/plugins/webtrekk"]
Now you can use the plugin just like in a normal Vue application, which means you have access to this.$webtrekk
and the v-webtrekk
directive in your components (see Tracking Configuration). Track requests will be sent on the client-side only, never on the server or during generation.
Was this article helpful?