Creating a Custom Facebook Audience with Facebook Pixel

To create custom audiences for ads, we enable you to send two types of events to your Facebook pixel:

  • When a customer submits a review ("ReviewSubmitted")
  • When a customer visits your store through a Loox Referrals link ("LooxReferralsVisit"

Follow these steps to send these events to your Facebook pixel:

  1. Copy this code:
    <script>
    (function (report_fb_pixel) {
        var url_params = new URLSearchParams(window.location.search);
        var utm_campaign = url_params.get('utm_campaign');
        if (!utm_campaign) return;
    
    
        var rating = parseInt(url_params.get('rating'));
        var event_name = null;
    
    
        if (utm_campaign === 'loox-referrals') {
            event_name = 'LooxReferralsVisit';
        } else if (/^loox/gi.test(utm_campaign) && rating >= 1) {
            event_name = 'ReviewSubmitted';
        } else {
            return;
        }
    
    
        if (typeof fbq === "function") return fbq('track', event_name);
    
    
        !function (f, b, e, v, n, t, s) {
            if (f.fbq) return;
            n = f.fbq = function () { n.callMethod ? n.callMethod.apply(n, arguments) : n.queue.push(arguments) };
            if (!f._fbq) f._fbq = n;
            n.push = n;
            n.loaded = !0;
            n.version = '2.0';
            n.queue = [];
            t = b.createElement(e);
            t.async = !0;
            t.src = v;
            s = b.getElementsByTagName(e)[0];
            s.parentNode.insertBefore(t, s)
        }(window, document, 'script', 'https://connect.facebook.net/en_US/fbevents.js');
    
    
        fbq('init', report_fb_pixel);
        fbq('track', event_name);
    })('<YOUR-FB-PIXEL-ID>');</script>
    	
  2. Paste the code in your theme.liquid file in your Shopify theme:
  3. Replace <YOUR-FB-PIXEL-ID> with your Facebook Pixel ID
  4. Click "Save

Note: If you'd like to only send "ReviewSubmmited" events starting from a certain minimum rating, edit the following piece of the code:

} else if (/^loox/gi.test(utm_campaign) && rating >= 1) {

Creating a custom audience in Facebook based on the events

To create a custom audience based on submitted reviews or referral visits, follow the steps below:

  1. Go to the Audience menu in your Facebook Business Manager:
  2. Click "Create Audience" and select "Custom Audience":
  3. Select "Website":
  4. Select "ReviewSubmitted" or "LooxReferralsVisit", within the "From your events" section:
  5. Name your audience and click "Create audience"

Note: If you are not able to see the event type in the "From your events" list, please try again later as this can take a while to be updated by Facebook

If you have any questions, feel free to contact our Support team at [email protected], and we’d be more than happy to help!

Still need help? Contact Us Contact Us