nuxt3-tiktok-pixel
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i nuxt3-tiktok-pixel

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

8.65 kB

Total Files

9

Last publish

Collaborators

  • ppb_studios