My client sells in an online marketplace like Amazon. We've setup a branded domain example.com
that redirects users to her storefront page, ecommerce-site.com/example
. example.com
basically just serves 302
redirect responses.
She's been creating Facebook ads for her products and been tracking the ad performance w/ the ads' cost per link click. We're trying to eventually optimize the ads for cost per purchase. We've setup a postback link in the e-commerce site to example.com/facebookPostback
that will send Purchase
events to Facebook. For now, we're gonna optimize it for Landing page views as she builds her customer base.
What I've done is every time example.com
is visited, a PageView
event is sent to the Pixel we've setup for her ads.
Here's how I've been sending the event using node express:
const userData = new fbSdk.UserData()
.setClientIpAddress(ipAddress)
.setClientUserAgent(userAgent);
if (fbc) {
userData.setFbc(fbc);
}
if (fbp) {
userData.setFbp(fbp);
}
const serverEvent = new fbSdk.ServerEvent()
.setEventName("PageView")
.setEventTime(Math.round(new Date().getTime() / 1000))
.setEventSourceUrl(`https://example.com${req.originalUrl}`)
.setUserData(userData);
const eventsData = [serverEvent];
const eventRequest = new fbSdk.EventRequest(
accessToken,
pixelId
).setEvents(eventsData);
fbc
is generated from the request's fbclid
if it exists. fbp
is generated is taken from the _fbp
cookie. If the cookie does not exist, my server generates it. Normally, with browser-based pixel events, _fbp
is generated using the client timestamp new Date().getTime())
and some random number. I've just done the same on the server-side and create a set-cookie
header for it in the redirect response.
Looking at the Pixel's dashboard, all the events are being received and processed successfully with no errors in the Diagnostics tab (Browser events are from Facebook's instant experience):
However, the events sent by the server are not being attributed to the ads. I created a separate ad without instance experience to test this out and that ad received 100 link clicks without any Landing page views.
My questions:
- Do you guys have any idea why this isn't working? Is it because
example.com
is just producing redirect responses? - How does Facebook attribute an advertisement for a Page view and does this attribution model work with server-side
PageView
events?