Skip to content

ppbstudios/nuxt3-tiktok-pexel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors