Skip to main content
All CollectionsGetting Started Required SetupEnable Tracking
Custom Pixel for Shopify Checkout Extensibility
Custom Pixel for Shopify Checkout Extensibility

How to add a Custom Pixel to Shopify.

Admetrics avatar
Written by Admetrics
Updated over 3 weeks ago

1. Open Shopify.

2. Go to SettingsCustomer Events.

3. Click “Add custom pixel”.

4. Name the Pixel “Admetrics Checkout Pixel”.

5. Under Customer privacy:

  1. Set Permission to Required and select Analytics.

  2. Ensure Data Sale is set to “Data collected does not qualify as data sale

6. Paste the following code into the text box,

and make sure to replace SHOP_ID_GOES_HERE with the correct shop ID. Retrieve your shop ID by clicking here, adjusting the domain to your shop, and searching for shopId.

analytics.subscribe('all_events', (event) => {
switch (event.name) {
case 'checkout_started':
case 'checkout_completed':
case 'checkout_shipping_info_submitted':
case 'checkout_contact_info_submitted':
case 'checkout_address_info_submitted':
(function (w, d, s) {
var SID = 'SHOP_ID_GOES_HERE';

if (event.name !== 'checkout_completed') {
w.admDataLayer = w.admDataLayer || [];
w.admDataLayer.push({ name: event.name });
}

var f=d.getElementsByTagName(s)[0],
l=d.createElement(s),j=d.createElement(s),k=d.createElement(s);
f=f.parentNode?f:d.getElementsByTagName("head")[0];

_r('js-app-admq-script');
j.id = 'js-app-admq-script';
j.async = true;
j.src = 'https://shopify.admetrics.events/conversion-v1.min.js';

_r('js-app-admq-data');
var ccod = event.data && event.data.checkout,
cod = (ccod && ccod.order)||{},
coi=cod.id||"",cci=cod.customer?cod.customer.id||"":"",
sccps = (ccod && ccod.totalPrice && ccod.totalPrice.amount);

l.id = 'js-app-admq-data';
(l.type = 'application/json'),
(l.textContent = JSON.stringify({
sid: SID,
oid: coi,
cid: cci,
sccps: sccps,
}));

_r('js-app-admq-data-ev');
k.id = 'js-app-admq-data-ev';
(k.type = 'application/json'),
(k.textContent = JSON.stringify(event.data || {}));

_a(l) && _a(j) && _a(k);

function _r(e){
var n=d.getElementById(e);
return n&&n.parentNode.removeChild(n)}
function _a(e){
return f.parentNode?f.parentNode.insertBefore(e,f):
f.appendChild(e);}
})(window, document, 'script');
break;
default:
return;
}
});

❗Please note that if you are using custom first party domain tracking you need to replace the domain shopify.admetrics.events in the script with your custom domain.

7. Click “Save” and then “Connect”.

Did this answer your question?