-
-
Notifications
You must be signed in to change notification settings - Fork 243
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integration Request: Facebook Pixel #54
Comments
Hey @jasongi-actu A fb pixel would be a great plugin 😃
When
The data passed into the identify call is up to the application itself. The only required field is the Inside of the plugin, you can manipulate/enrich the data however you'd like. Here's a plugin scaffold: export default function facebookPixelPlugin(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:
More in the docs on this here https://getanalytics.io/tutorials/sending-provider-specific-events/ |
I've put together a sketch for this that works with my Next JS app. let fb;
let fbLoaded = false;
export default function facebookPixelPlugin(userConfig = {}) {
return {
name: "facebook-ads",
config: {
...userConfig,
},
initialize: async ({ config }) => {
const { pixelId } = config;
await import("react-facebook-pixel")
.then((module) => (fb = module.default))
.then(() => {
if(!fbLoaded) {
fb.init(pixelId, {
autoConfig: true,
debug: true,
});
fbLoaded = true;
}
});
},
page: ({ payload }) => {
fb.pageView();
},
/* Track event */
track: ({ payload }) => {
console.log("facebook track", payload)
fb.track(payload.event, payload.properties)
},
/* Identify user */
identify: ({ payload }) => {
// I believe FB doesn't have an identify API any more
},
loaded: () => {
return fbLoaded;
},
};
} |
Hi folks. Looks like this thread has been inactive for some time... Are there plans to productionize this? |
Happy to accept a PR on this 😃 |
Moved to #153 |
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:
The text was updated successfully, but these errors were encountered: