Skip to content

alihamza1214/nuxt-snack-video-pixel-module

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nuxt-snack-video-pixel-module

npm version npm js-standard-style

A NuxtJS module that injects Snack Video Pixel code with custom tracking functionality

Table of Contents

Requirements

  • npm or yarn
  • NuxtJS
  • NodeJS

Install

$ npm install --save nuxt-snack-video-pixel-module
// or
$ yarn add nuxt-snack-video-pixel-module

Getting Started

Add nuxt-snack-video-pixel-module to modules section of nuxt.config.js.

{
  modules: [
    // Simple usage
    'nuxt-snack-video-pixel-module',

    // With options
    ['nuxt-snack-video-pixel-module', {
      /* module options */
      pixel: 'SNACK_PIXEL_ID',
      disabled: false
    }],
 ]
}

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:

Now, in your component, you can call the following in order to start the pixel and track the current page.

this.$kwaiq.enable()

For Custom Tracking, you can call the following:

 this.$kwaiq.track("addToCart", {
    content_type: "product",
    content_id: this.product._id,
    content_name: this.product.name,
    currency: "PKR",
    price: this.calculatePrice,
    value: this.calculatePrice
});

or

this.$kwaiq.track("purchase", {
    content_type: "product",
    currency: "PKR",
    contents: this.calculateProductArray(this.order.items),
    value: this.order.amount.total,
});

Module options

List of possible options in the module:

Option Default Required Description
pixel null true The pixel identifier provided by Snack Video business.
disabled false false Disable the pixel by default when initialized. Can be enabled later through $kwaiq.enable().

License

[MIT License]

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published