DocsIntegrationsShopify Integration
Integrations

Shopify Integration

Overview

Complete GDPR compliance and analytics for Shopify stores. Automatic e-commerce event tracking included.

Difficulty: Easy

Add code to theme.liquid and you're ready to go.

Installation

Method 1: Theme Editor

  1. Go to Online Store → Themes → Customize
  2. Click Theme Settings (gear icon)
  3. Find Custom Liquid or Head HTML
  4. Add the CONSETO snippet

Method 2: Edit Theme Code

  1. Go to Online Store → Themes → Actions → Edit Code
  2. Open theme.liquid
  3. Find </head> tag
  4. Add the snippet before </head>
liquid
<!-- CONSETO GDPR & Analytics -->
<script src="https://www.conseto.io/dist/conseto.min.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', async function() {
    const conseto = await Conseto.init({
      clientId: '{{ settings.conseto_client_id | default: "YOUR_CLIENT_ID" }}',
      language: '{{ request.locale.iso_code | slice: 0, 2 | default: "en" }}',
      theme: 'dark',
      autoTrackEcommerce: true,

      {% if settings.ga4_id %}
      ga4: '{{ settings.ga4_id }}',
      {% endif %}

      {% if settings.gtm_id %}
      gtm: '{{ settings.gtm_id }}',
      {% endif %}

      brandName: '{{ shop.name }}',
      privacyPolicyUrl: '{{ pages.privacy-policy.url | default: "/pages/privacy-policy" }}',
      cookiePolicyUrl: '{{ pages.cookie-policy.url | default: "/pages/cookie-policy" }}'
    });

    window.conseto = conseto;
  });
</script>

Theme Settings

Add to config/settings_schema.json:

json
{
  "name": "CONSETO",
  "settings": [
    {
      "type": "text",
      "id": "conseto_client_id",
      "label": "CONSETO Client ID",
      "info": "Get this from your CONSETO dashboard"
    },
    {
      "type": "text",
      "id": "ga4_id",
      "label": "Google Analytics 4 ID",
      "placeholder": "G-XXXXXXX"
    },
    {
      "type": "text",
      "id": "gtm_id",
      "label": "Google Tag Manager ID",
      "placeholder": "GTM-XXXXXX"
    }
  ]
}

Automatic Event Tracking

CONSETO automatically tracks these Shopify events:

EventShopify Page
view_itemProduct pages
view_categoryCollection pages
add_to_cartCart additions
begin_checkoutCheckout start
purchaseThank you page
searchSearch results

Checkout Tracking (Shopify Plus)

For Shopify Plus stores, add to Checkout Settings → Additional Scripts:

liquid
{% if first_time_accessed %}
<script src="https://www.conseto.io/dist/conseto.min.js"></script>
<script>
  (async function() {
    const conseto = await Conseto.init({
      clientId: 'YOUR_CLIENT_ID',
      autoTrackEcommerce: false
    });

    conseto.trackConversion('purchase', {
      transaction_id: '{{ order.name }}',
      value: {{ total_price | money_without_currency | remove: ',' }},
      currency: '{{ currency }}',
      tax: {{ tax_price | money_without_currency | remove: ',' }},
      shipping: {{ shipping_price | money_without_currency | remove: ',' }},
      items: [
        {% for line_item in line_items %}
        {
          item_id: '{{ line_item.product_id }}',
          item_name: '{{ line_item.title | escape }}',
          price: {{ line_item.price | money_without_currency | remove: ',' }},
          quantity: {{ line_item.quantity }}
        }{% unless forloop.last %},{% endunless %}
        {% endfor %}
      ]
    });
  })();
</script>
{% endif %}
CONSETO - GDPR Compliance & Web Analytics