Faraday Pixel
Install the Faraday Pixel
Before you start, Visitor Context must be turned on for your account, and you need a Faraday Pixel dataset. See Visitor Context for how to create one.
Add the tag to every page of your site using the instructions below. Replace <site_id> with the dataset's site_id; the Faraday Pixel dataset's Definition tab shows the tag with it filled in. Once the tag is in place, new identified visitors appear in the dataset on its next refresh.
Create both tags below, then publish the container.
Tag 1: load the pixel
- Create a Custom HTML tag and paste in the tag below.
- Under Advanced Settings, set Tag firing options to Once per page.
- Set its trigger to Initialization - All Pages, or your cookie consent trigger if your site has a banner. Don't add a History Change trigger to this tag.
- If your site uses GTM consent settings, require
ad_storage.
<!-- Initialize queue and set global custom data BEFORE SDK loads -->
<script type="text/gtmscript">
!function(e) {
e._oirtrk = e._oirtrk || [];
e._oirtrk.push(['set', 'site_id', '<site_id>']);
}(window);
</script>
<!-- Load SDK -->
<script type="text/gtmscript">
!(function (s) {
let o = s.createElement('script'), u = s.getElementsByTagName('script')[0];
o.src = 'https://cdn.aggle.net/oir/oir.min.js';
o.async = !0, o.setAttribute('oirtyp', '6311ae17'), o.setAttribute('oirid', 'PPDP395B7');
u.parentNode.insertBefore(o, u);
})(document);
</script>
Tag 2: record later page views
- Create a second Custom HTML tag and paste in the tag below.
- Set Tag firing options to Once per event.
- Set its trigger to History Change, firing on all history changes.
- Give it the same consent setting as Tag 1.
<script>
window._oirtrk = window._oirtrk || [];
window._oirtrk.push(['track', 'page_view', {
page: location.href,
title: document.title,
referrer: document.referrer
}]);
</script>
Optional: record custom events
- Create a Custom HTML tag and paste in the tag below, with your own event name and values.
- Set Tag firing options to Once per event.
- Set its trigger to the action you want to record, such as an add to cart.
- Give it the same consent setting as Tag 1.
<script>
window._oirtrk = window._oirtrk || [];
window._oirtrk.push(['event', {
event: 'add_to_cart',
payload: {
product_id: 'SKU-1',
price: 29.99
}
}]);
</script>
Leave names, email addresses, phone numbers and other personal details out of payload.
Consent
The pixel matches visitors to known contacts for marketing, which privacy laws such as CCPA and GDPR may treat as a sale or share of personal information. If your site has a cookie consent banner, load the tag only after the visitor accepts marketing cookies, and honor opt-outs and Global Privacy Control.
Leave the tag off logged-in portals and any page that collects health information. See HIPAA data.
Content Security Policy
If your site sends a Content Security Policy, add these sources to it:
Content-Security-Policy: script-src 'self' cdn.aggle.net lijit.com *.lijit.com liadm.com *.liadm.com alocdn.com *.alocdn.com nytrng.com *.nytrng.com; frame-src 'self' lijit.com *.lijit.com liadm.com *.liadm.com alocdn.com *.alocdn.com nytrng.com *.nytrng.com; img-src 'self' *.aggle.net lijit.com *.lijit.com liadm.com *.liadm.com alocdn.com *.alocdn.com nytrng.com *.nytrng.com; connect-src 'self' *.aggle.net lijit.com *.lijit.com liadm.com *.liadm.com alocdn.com *.alocdn.com nytrng.com *.nytrng.com
That list can change, so watch your CSP violation reports for new domains.
Check that it's working
- Install the tag in staging first and tell your Faraday contact. Faraday will then confirm that events are arriving before you move the tag to production.
- Open a page of your site with your browser's developer tools open, accept marketing cookies, and turn off any ad blocker. The Network tab should show a request for
oir.min.jsfromcdn.aggle.net. You can also search the Network tab for yoursite_id. - After the dataset's next refresh (once a day by default), identified visitors appear in it. Not every visitor is identified, so your own test visit may not appear.
Troubleshooting
- The script doesn't load. Check that the tag is published, that it fires on all pages, and that you accepted the consent category it's behind. An ad blocker can also block it.
- The browser console shows CSP errors. Add the sources above to your Content Security Policy, plus any new domain your violation reports name.
- Only the first page of each visit shows up. Your site changes pages without reloading, so the pixel needs to be told about later pages. Add Tag 2 in Google Tag Manager, or call
trackFaradayPageView()from your router. - You don't want to wait for the daily refresh. Choose Force update from the dataset's ... menu to refresh it now.
- The script loads, but no visitors appear after a day. Sites with little traffic may see few identified visitors at first. If none appear after a few days, contact your account team.