nuxt3-tiktok-pixel
TikTok pixel module modeled after the Facebook pixel module
1,988
| Install | |
|---|---|
npm install nuxt3-tiktok-pixel |
|
| Latest Version: | 1.0.1 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | May 21, 2024 |
| Links: | GitHub · npm |
Maintainer: ppb_studios
Nuxt plugin for tiktok pixel (Nuxt 3)
A Nuxt 3 module thats injects Tiktok Pixel (tiktok Pixel)
Table of Contents
Requirements
- npm or yarn
- NuxtJS
- NodeJS
$ npm install --save nuxt3-tiktok-pixel
// or
$ yarn add nuxt3-tiktok-pixel
Getting Started
Add nuxt3-tiktok-pixel to modules section of nuxt.config.js.
{
modules: [
'nuxt3-tiktok-pixel',
],
tiktok: {
pixelId: 'PIXEL_KEY',
track: "ViewContent",
autoViewContent: true,
debug: true,
}
}
Automatically track PageView
By default, the module won't trigger any tracking event on route change. To enable this behaviour, you must specify the autoPageView option and set to true in the Nuxt module options.
{
modules: [
'nuxt3-tiktok-pixel',
],
tiktok: {
/* module options */
pixelId: 'PIXEL_KEY',
autoPageView: true
},
}
Disabling the pixel (for GDPR)
If you'd like to install the pixel disabled, and enable it later after the user has consented to its use, you can do so by setting disabled: true in the pixel configuration:
{
modules: [
'nuxt3-tiktok-pixel',
],
tiktok: {
...
disabled: true
},
}
Now, in your component, you can call the following in order to start the pixel and track the current page.
this.$tt.enable()
The pixel can be disabled again later on by using the .disable() method.
Related Packages
@nathanchase/nuxt-dayjs-module
This is a Nuxt 3 compatible module built with the official Nuxt 3 (module-builde...
19,376
31
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 1.0.1 | ^3.0 | MIT |