← Starting Page

Getting Started

Required Setup

Optional Setup

Data Studio Overview

Dashboards

Performance

Creatives

Settings

Help

Understand your reports

Tips and Tricks

Attribution Models

Bayesian Statistics

User Journey Tracking

Understand your Metrics

Metrics Overview

Product Level Metrics

Target Metrics

Data Loading

Data Updates

Data Loading Issues

Data Discrepancies

Frequently Asked Questions

Releases & ChangeLog

← How to enable tracking and consent

<aside> 💡 Written by tbd, last updated on tbd in tbd

</aside>

What you will learn in this article:

Add a Custom Pixel

  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”.

    custom pixel settings.png

  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);
                    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 cod = (event.data && event.data.checkout &&
                               event.data.checkout.order)||{},
                        coi=cod.id||"",cci=cod.customer?cod.customer.id||"":"";
    
                    l.id = 'js-app-admq-data';
                    (l.type = 'application/json'),
                        (l.textContent = JSON.stringify({
                            sid: SID,
                            oid: coi,
                            cid: cci,
                        }));
                    _a(l) && _a(j);
    
                    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;
        }
    });
    
  7. Click “Save” and then “Connect”.


Did this article answer your question?