Hi, I'm trying to use a context enricher
Hi, I'm trying to use a context enricher to remove the referrer property when the traffic is coming from a payment processor in order to prevent it from showing up in Google Analytics as traffic. This is the context enricher worker I wrote:
const referrerList = [
'pay.skrill.com',
'commerce.coinbase.com',
'paymentpage.ecommpay.com',
];
function checkReferrer({ system, client }) {
if (referrerList.some((referrer) => system.page.referrer.includes(referrer))) {
system.page.referrer = '';
}
return { client, system };
}
export default {
async fetch(request, env, ctx) {
const { system, client } = await request.json();
const newContext = checkReferrer({ system, client });
return new Response(JSON.stringify(newContext));
}
};
I've added it to Zaraz settings (see attached screenshot) but nothing seems to be happening, the blocked referrers still show up in Google Analytics. Any help would be most welcome.
4 Replies
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
The workers & pages page says the worker was called two times in the last 24 hours (and I think those two were when I manually triggered it in testing) so It looks like it's not being called. Do you have any idea why that could be?
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
I tried to re-set it and it seems to be working, the number of requests is growing rapidly at least. Thanks!