Closed pepew-le-boss closed 1 year ago
The snowplow plugin was a contribution to the project. I don't use it myself and won't have time to fix or update it.
You can see the current implementation here https://github.com/DavidWells/analytics/blob/master/packages/analytics-plugin-snowplow/src/browser.js#L201-L219
That said, it's pretty easy to create a plugin for any provider. Here are the docs https://getanalytics.io/plugins/writing-plugins/#1-provider-plugins.
It's really a matter of mapping their calls, to the analytics primitives page
, track
, identity
etc
export default function providerPluginExample(userConfig) {
// return object for analytics to use
return {
/* All plugins require a name */
name: 'my-example-plugin',
/* Everything else below this is optional depending on your plugin requirements */
config: {
whatEver: userConfig.whatEver,
elseYouNeed: userConfig.elseYouNeed
},
initialize: ({ config }) => {
// load provider script to page
},
page: ({ payload }) => {
// call provider specific page tracking
},
track: ({ payload }) => {
// call provider specific event tracking
},
identify: ({ payload }) => {
// call provider specific user identify method
},
loaded: () => {
// return boolean so analytics knows when it can send data to third party
return !!window.myPluginLoaded
}
}
}
I'm working on a NextJS project and after setting everything up I get this error:
After some research it seems that
snowplow-tracker
is deprecated. Also@analytics/snowplow
has not been updated for 2 years now so maybe these problems are linked.analytics.ts
:random react component: