@simpozio/gatsby-plugin-analytics
v0.0.4
Published
Plugin for handling event tracking with Google Analytics and Facebook Pixel.
Readme
Gatsby Plugin for Analytics
Gatsby plugin that combined logic of Google Analytics and Facebook Pixel in single plugin.
Installation
npm i @simpozio/gatsby-plugin-analyticsUsage
Install plugin package from npm and add plugin configuration to your gatsby-config.js file
/* gatsby-config.js */
module.exports = {
plugins: [
{
resolve: '@simpozio/gatsby-plugin-analytics',
options: {
head: true,
fbq: {
pixelId: 'your Facebook pixel id',
disablePushState: true,
trackViewContent: false,
trackPageView: false
},
gtag: {
trackingIds: ['your Google Analytics id', 'your Google Ads id', 'your Marketing Platform id'],
trackPageView: false,
}
}
}
]
}Options
head: boolean- iftrueinclude script tags into head, else add them to the bodyfbq: object- configuration for Facebook Pixel, includes next properties:pixelId: number- your Facebook Pixel IDdisablePushState: boolean- enable/disable PageView tracking on History updatestrackViewContent: boolean- enable/disable tracking of ViewContent event on every route updatetrackPageView: boolean- enable/disable default PageView tracking
gtag: object- configuration for Google gtag.js, includes next properties:trackingIds: string[]- array of tracking ID's of Google Services fits pattern - ['your Google Analytics id', 'your Google Ads id', 'your Marketing Platform id']trackPageView: boolean- enable/disable default PageView tracking
