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
hi @abhishekpatel946
does this work for you? when I dropped this into my project, it does indicate facebook in the sources for the page, but no events were being fired and the meta pixel helper plugin couldn't detect pixel on the site.
@harrisyn I used this code earlier as utility with getAnalytics plug-in at that time getAnalytics do not directly suuport the facebook pixel. So i was created this as a utility and integrate with getAnalytics and it worked for me.
If it's not working properly then we can fix this.
On Wed, Sep 27, 2023 at 9:12 AM Abhishek Patel ***@***.***> wrote:
@harrisyn <https://github.com/harrisyn> I used this code earlier as
utility with getAnalytics plug-in at that time getAnalytics do not directly
suuport the facebook pixel. So i was created this as a utility and
integrate with getAnalytics and it worked for me.
If it's not working properly then we can fix this.
—
Reply to this email directly, view it on GitHub
<#153 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABF3YIIM2GA3LM7A6CEUPW3X4PUYXANCNFSM4ZAQANCQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
Would appreciate any insights, I have previously integrated other plugins successfully. When I use a useEffect to load the react pixel it works fine …
On Wed, Sep 27, 2023 at 9:12 AM Abhishek Patel @.> wrote: @harrisynhttps://github.com/harrisyn I used this code earlier as utility with getAnalytics plug-in at that time getAnalytics do not directly suuport the facebook pixel. So i was created this as a utility and integrate with getAnalytics and it worked for me. If it's not working properly then we can fix this. — Reply to this email directly, view it on GitHub <#153 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABF3YIIM2GA3LM7A6CEUPW3X4PUYXANCNFSM4ZAQANCQ . You are receiving this because you were mentioned.Message ID: @.>
Yes, I am using useEffect to capture the event in my case.
To answer your question in detail so dump all the code and utility for analytics down below.
import Analytics from 'analytics'
import { env } from '../../configs'
import facebookPixel from './FacebookPixel'
import postHog from './Posthog'
/* initialize analytics and load plugins */
const analytics = Analytics({
app: 'app_name',
debug: false,
plugins: [
// Facebook Pixel
facebookPixel({
pixelId: env.FACEBOOK_PIXEL,
enabled: true,
}),
],
})
And create a new file where I put facebook-pixel-plugin code and in above code.
in your example the "enabled" property doesn't seem to be used, so i will discount that as a difference, other than that I think my implementation is almost identical (mine is typescript).
However it doesn't send any events.
when I console log, I can see that the track and page events are being called, logging the fb object also shows the pixel plugin properties but the events don't react fb (I confirmed that the pixelid is correct).
when I use the react-facebook-pixel plugin directly within useEffect
Then you should use the useEffect to capture the event. Not sure why it is not capturing the event once component mount? 🤔 May be it is dependent on some client side effects or window.
That's why I also use this inside useEffect if you my above code.
Activity
JaneJeon commentedon Feb 23, 2022
Just a quick note, shouldn't the
Plausiblecheckbox be ticked considering a Plausible plugin is already listed on your README? https://github.com/DavidWells/analytics#community-pluginsakafaneh commentedon Jun 1, 2022
#278
Anyone have Adobe Analytic plugin they wrote?
abhishekpatel946 commentedon Aug 27, 2022
Support of Facebook Pixel Custom Plugin with getAnalytics.
https://gist.github.com/abhishekpatel946/f003011fcfa991f29b54c66cb2ec0b6e
abhishekpatel946 commentedon Aug 27, 2022
Support of Posthog Custom Plugin with getAnalytics.
https://gist.github.com/abhishekpatel946/f671edc2640be436a1ac1744806c4fab
harrisyn commentedon Sep 27, 2023
hi @abhishekpatel946
does this work for you? when I dropped this into my project, it does indicate facebook in the sources for the page, but no events were being fired and the meta pixel helper plugin couldn't detect pixel on the site.
abhishekpatel946 commentedon Sep 27, 2023
@harrisyn I used this code earlier as utility with getAnalytics plug-in at that time getAnalytics do not directly suuport the facebook pixel. So i was created this as a utility and integrate with getAnalytics and it worked for me.
If it's not working properly then we can fix this.
harrisyn commentedon Sep 27, 2023
abhishekpatel946 commentedon Sep 28, 2023
Yes, I am using
useEffectto capture the event in my case.To answer your question in detail so dump all the code and utility for analytics down below.
And create a new file where I put
facebook-pixel-plugincode and in above code.and I am using this inside the components to capture the with the help of
useEffects()harrisyn commentedon Sep 28, 2023
in your example the "enabled" property doesn't seem to be used, so i will discount that as a difference, other than that I think my implementation is almost identical (mine is typescript).
However it doesn't send any events.
when I console log, I can see that the track and page events are being called, logging the fb object also shows the pixel plugin properties but the events don't react fb (I confirmed that the pixelid is correct).
when I use the react-facebook-pixel plugin directly within useEffect
``
useEffect(() => {
const store: any = state?.storeData
if (isEmpty(store)) return
const facebookPixel = store?.socials?.find(
(x: any) => x.slug === 'facebook-pixel',
)
if (!facebookPixel || store?.plan !== 'paid') return
const facebookPixelId = facebookPixel?.id
import('react-facebook-pixel')
.then((x) => x.default)
.then((ReactPixel) => {
ReactPixel.init(facebookPixelId, null, {
autoConfig: true,
debug: !isProduction,
}) // facebookPixelId
ReactPixel.pageView()
// console.log("ReactPixel", ReactPixel)
router.events.on('routeChangeComplete', () => {
ReactPixel.pageView()
})
})
}, [router.events, state?.storeData])
``
it works fine.
abhishekpatel946 commentedon Sep 28, 2023
Then you should use the useEffect to capture the event. Not sure why it is not capturing the event once component mount? 🤔 May be it is dependent on some client side effects or window.
That's why I also use this inside useEffect if you my above code.
daun commentedon Jun 29, 2026
A third-party Matomo plugin is now available at analytics-plugin-matomo.