It should be a standard feature in Facebook’s Business Manager–to be able to create a custom audience based on referrer url. But it’s not. And, it’s more complicated to do if you’re using Shopify and Google Tag Manager.
If you’ve set up your Facebook pixel in Shopify using the Preferences then you’re already tracking Facebook’s standard events. But you’re not tracking the referrer parameter on the standard Pageview event. Referrer URL is a custom parameter that has to be added separately.
If you had installed the Facebook pixel manually in Shopify by adding it to your theme.liquid file and your checkout.liquid file (Shopify Plus) or Additional Scripts area, then you could just go into it and modify it with the JSON code below before the closing script tag.
You might be thinking: Why don’t I just remove the pixel from the Preferences area and install it manually, then?
That’s because if you’re using Google Tag Manager to manage other tags and don’t want them to stop firing, you can’t. Shopify documents that in order to use Google Tag Manager, you must be using their native integration for both.
Neither Facebook nor Google has documentation for what to do in this situation. Actually, some of their documentation is misleading. Facebook actually says that referrer is a standard parameter that is tracked when your pixel is initially set up. We reached out to support, and they apologized for the error in the post and said they would update it.
The Solution:
Inside Google Tag Manager, create a new tag with your standard Pageview trigger. The tag type will be custom HTML with the same script I referenced earlier.
Save the tag, re-publish your workspace and you’ll start seeing referrer data ONLY in Facebook’s Analytics area. Go to Analytics > Activity > Event Debugging.
If you’re looking for the referrer data on your pixel overview screen, inside the pageview event details, you’ll see a warning message (below). That’s normal as this was a custom parameter, and this specific parameter can only be viewed in event debugging.
But, what you will now notice is that when going to create a custom audience, if you select Website > From Your Events > Pageview, you can now refine by your custom parameter (referrer)–instead of just URL.
Now you can create custom audiences based on specific referrers and use those audiences in your ad campaigns.
It’s a simple solution that took way too long to get to. I hope it helps someone else out there, enjoy it.