Nuxt plugin for LinkedIn pixel
npm install nuxt-linkedin-pixel-module



> A NuxtJS module thats injects LinkedIn Pixel code
Inspired by https://github.com/WilliamDASILVA/nuxt-linkedin-pixel-module
* Requirements
* Install
* Getting Started
* License
* npm or yarn
* NuxtJS
* NodeJS
``bash`
$ npm install --save nuxt-linkedin-pixel-module
// or
$ yarn add nuxt-linkedin-pixel-module
Add nuxt-linkedin-pixel-module to modules section of nuxt.config.js.`js
{
modules: [
// Simple usage
'nuxt-linkedin-pixel-module',
// With options
['nuxt-linkedin-pixel-module', {
/ module options /
partnerId: 'LINKEDIN_PIXEL_ID',
disabled: false
}],
]
}
``
or evenjs`
{
modules: [
'nuxt-linkedin-pixel-module',
],
linkedin: {
/ module options /
partnerId: 'LINKEDIN_PIXEL_ID',
disabled: false
},
}
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:
`js`
{
modules: [
'nuxt-linkedin-pixel-module',
],
linkedin: {
...
disabled: true
},
}
Now, in your component, you can call the following in order to start the pixel and track the current page.
`js`
this.$li.enable()
List of possible options in the module:
| Option | Default | Required | Description |
|----------|----------|----------|-------------------------------------------------------------------------------------------|
| partnerId | null | true | The unique insight tag ID (usually 6 digits) identifier provided by LinkedIn (can be located within the `Set up your insight Tag` dialog displayed as: `__linkedin_partner_id = "xxxxxx";`. |$li.enable()
| disabled | false | false | Disable the Pixel by default when initialized. Can be enabled later through .
The tracking pixel instance is available on all vue component instances as $li. It has the following methods:
| Method | Purpose | Equivalent to |
|-------------------|----------------------------------------------------------------------------------------------------------|--------------------------------|
| enable() | If you had previously set disabled: true` in config, enables the pixel and tracks the current page view | $li.init() |