Window.fbq is not a function
Unanswered
Californian posted this in #help-forum
CalifornianOP
Attempting to use facebook pixel to track events on client side:
Pretty much following all steps in NextJS pixel repo:
https://github.com/vercel/next.js/tree/canary/examples/with-facebook-pixel/app
I have a
I have the
I have the
However, when I attempt to log any event using the pixel I get an error.
Usage:
and error in the browser is:
pointing to the
Why am I getting this error? Pls help
Pretty much following all steps in NextJS pixel repo:
https://github.com/vercel/next.js/tree/canary/examples/with-facebook-pixel/app
I have a
pixel.js script in my public/scripts folder.I have the
FacebookPixel Component inside my layout.tsxI have the
fpixel.js file in my library However, when I attempt to log any event using the pixel I get an error.
Usage:
import * as fbq from "../../../library/third-party/fpixel"
fbq.event("Purchase", { currency: "GBP", value: 1 });and error in the browser is:
TypeError: window.fbq is not a functionpointing to the
fpixel.js file which conveniently exports the event for us to use easily. Why am I getting this error? Pls help