You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in the process of integrating analytics, I really like the concept and the library!
Am probably going to end up writing a barebones Facebook Pixel plugin, just thought I would make a ticket to see it. It has a pretty simple API that I think will map well.
Some issues I've encountered:
Facebook PageView event doesn't let you tell it what page you're viewing, it takes it straight from the URL. It also does this automatically (even in SPAs) unless you configure disablePushStateTracking
It doesn't look like analytics standardises what you pass to identify which makes it hard to make a single identify call if you are for instance using segment and facebook which have different field names.
Reacted by Christopher Dengsø, Mike Wagz, Trent Holliday and Fedor Parfenov
Facebook PageView event doesn't let you tell it what page you're viewing, it takes it straight from the URL. It also does this automatically (even in SPAs) unless you configure disablePushStateTracking
When analytics.page() is called it uses a similar mechanism where it will grab the current page url & title.
It doesn't look like analytics standardises what you pass to identify which makes it hard to make a single identify call if you are for instance using segment and facebook which have different field names.
The data passed into the identify call is up to the application itself. The only required field is the userId
Inside of the plugin, you can manipulate/enrich the data however you'd like. Here's a plugin scaffold:
exportdefaultfunctionfacebookPixelPlugin(userConfig={}){return{name: 'facebook-ads',config: {
...defaultConfig,
...userConfig},initialize: ({ config })=>{// Load pixel script here},page: ({ payload })=>{// trigger page pixel},/* Track event */track: ({ payload })=>{// trigger custom event pixel ? idk if thats a thing 😃},/* Identify user */identify: ({ payload })=>{// Alter the payload & payload.properties however you want before // triggering the pixel },loaded: ()=>{return!!window.providerExampleLoaded}}}
It is possible to send specific calls to specific providers like so:
// Disable sending user data to specific analytic tools
analytics.identify('xyz-123', { other: 'info' }, {
plugins: {
// disable sending this identify except to facebook
all: false,
'facebook-ads': true
}
})
Activity
DavidWells commentedon May 21, 2020
Hey @jasongi-actu
A fb pixel would be a great plugin 😃
When
analytics.page()is called it uses a similar mechanism where it will grab the current page url & title.The data passed into the identify call is up to the application itself. The only required field is the
userIdInside of the plugin, you can manipulate/enrich the data however you'd like. Here's a plugin scaffold:
It is possible to send specific calls to specific providers like so:
More in the docs on this here https://getanalytics.io/tutorials/sending-provider-specific-events/
stefl commentedon Nov 29, 2020
I've put together a sketch for this that works with my Next JS app.
jjoyce0510 commentedon Apr 21, 2021
Hi folks. Looks like this thread has been inactive for some time... Are there plans to productionize this?
DavidWells commentedon May 5, 2021
Happy to accept a PR on this 😃
DavidWells commentedon Jul 20, 2021
Moved to #153
pelim commentedon May 27, 2025