Alli Pixel Placement Instructions
The following documentation will walk through the placement instructions for the Alli Pixel. The Alli Pixel powers server-to-server enablement for the future of cookieless tracking to media platforms such as Facebook, Snapchat, and Pinterest.
If you have any questions following this set up, reach out to solutions-devs@pmg.com or tagging@pmg.com
The setup follows 3 steps:
Setting up the event_id
Setting up the Alli Pixel Events
Adding the event_id to traditional cookie tags
Step 1: Setting up the event_id
One variable referenced throughout the documentation is event_id
. This event_id
is used for deduplication in platforms. Meta provides an explanation of deduplication here but in summary, because media platforms, such as Meta, are now receiving two signals - from the browser with the cookie and from the server, the event_id is used to deduplicate those events on the platform.
This event_id
is flexible in set up but has the following requirements:
The
event_id
needs to be distinct for each page load.The same
event_id
needs to be sent for each platform event and corresponding Alli Pixel. For example, theevent_id
value needs to be the same for the Facebook Pixel Page View and the Alli Pixel Page View.event_id
must be unique for every distinct event type. It can be different for two different events so as long the events are different.Good Example:
Event Page View on Page A: 1678375710236.233028.13
Event Add to Cart on Page A: 1678375710236.233028.13
Explanation - Although the event_id’s are the same, it's for two different events that may happen on the same page load therefore the platform will deduplicate accordingly.
Bad Example:
Event Page View on Page A: 1678375710236.233028.13
Event Page View on Page B: 1678375710236.233028.13
Explanation - Both the event_id and event are the same, so although this may be two different PageViews, it will be deduplicated in platform as a single page view.
Step 2: Setting up the Alli Pixel Events
The following snippets are the events we need to track for the Alli Pixel. Bolded are the variables that need to be replaced with your chosen tag manager’s variables.
Initialization
Needs to fire on each page before the other Alli Pixels to install the library. Copy from here or Alli.
<script>
(function() {
if (!('alli' in window)) {
window.alli = function () {
window.alli.q.push(arguments);
};
window.alli.q = [];
}
var script = document.createElement('script');
script.src = 'https://cdn.allitrk.com/v1/allitrk.js';
script.async = true;
var firstScript = document.getElementsByTagName('script')[0];
firstScript.parentNode.insertBefore(script, firstScript);
})();
alli('init', {'key': 'exampleKey', collector: 'https://collector.allitrk.com/v1/collect'});
Page View
Needs to fire on each page after the initialization event. Copy from here or Alli.
<script>
alli('pageView', {event_id: '12345'});
</script>
Example Purchase
<script>
alli('purchase', { value: 1234, event_id : '12345', transaction_id : '1234', first_name : 'John', dob: '01/01/01', content_ids : ['123', '234', '345'], content_name : 'product', content_type : 'product', num_items : 3, city : 'example_city', state : 'example_state', zip : '11111', country : 'USA', last_name : 'Smith', quantity: 3, currency : 'USD', delivery_category : 'In-Store', email: 'randomemail@email.com', phone: '1234567890', contents: ['item1', 'item2', 'item3']});
</script>
Example View Content
<script>
alli('viewContent', { value: 1234, event_id : '12345', transaction_id : '1234', first_name : 'John', dob: '01/01/01', content_ids : ['123', '234', '345'], content_name : 'product', content_type : 'product', num_items : 3, city : 'example_city', state : 'example_state', zip : '11111', country : 'USA', last_name : 'Smith', quantity: 3, currency : 'USD', delivery_category : 'In-Store', email: 'randomemail@email.com', phone: '1234567890', contents: ['item1', 'item2', 'item3']});
</script>
Other events follow a similar setup and can be found in Alli.
Step 3: Adding the event_id to traditional cookie tags
The last and final step is to add the event_id to the original vendor (Meta, Snapchat, TikTok, Pinterest) tags for deduplication. For each Alli Pixel event tag you setup, please complete this for the corresponding vendor tag.
In each of these tags, you are adding one more additional parameter - the event_id
. If you are using a template, there should be a field to pass this variable through. If you are not using a template, it should look like the following as an example:
fbq('track', 'PageView', {}, {eventID: {eventID} });
Once you have done these 3 steps, reach out to tagging@pmg.com and they will assist in QAing.