Skip to main content

How to Set Up Server-Side GTM Integration with Shopflo

A step-by-step guide to setting up a GTM server-side container and receiving Shopflo checkout events — so you can send purchase data to GA4, Meta CAPI, Google Ads, and more from a single integration.

Written by Swapnil Sangal

A step-by-step guide for merchants to set up a GTM server-side container and receive Shopflo checkout events.

First time using GTM? Set up your GTM account and GCP billing before starting. Once that's ready, come back and follow the phases below.


How it works

Shopflo sends checkout events (purchase, address submitted, payment initiated, etc.) as a single HTTPS POST to your GTM server container. The container receives them via a custom client and fans them out to any destination you configure — GA4, Meta CAPI, Google Ads, and more.

One inbound POST → one client → many destinations.


Phase 1 — Create the GTM server container

~5 minutes

  1. Go to tagmanager.google.comCreate AccountCreate Container

  2. Set platform to Server

  3. On the next screen, choose Automatically provision tagging server → select your GCP project and region → Create

  4. Wait 3–5 minutes. Copy the tagging server URL once provisioning completes. It looks like: https://server-side-tagging-xxxx-uc.a.run.app


Phase 2 — Add the Shopflo S2S client

~10 minutes

  1. In your container: Templates → Client Templates → New

  2. Name it Shopflo S2S Client

  3. In the Fields tab, add one text field:

    • Display name: Request path

    • Name: requestPath

    • Default value: /shopflo/event

  4. In the Code tab, paste the Shopflo client code below. Save the template.

const claimRequest      = require('claimRequest');
const getRequestPath    = require('getRequestPath');
const getRequestMethod  = require('getRequestMethod');
const getRequestBody    = require('getRequestBody');
const returnResponse    = require('returnResponse');
const setResponseStatus = require('setResponseStatus');
const setResponseHeader = require('setResponseHeader');
const setResponseBody   = require('setResponseBody');
const runContainer      = require('runContainer');
const JSON              = require('JSON');
const logToConsole      = require('logToConsole');if (getRequestPath() !== data.requestPath) return;
if (getRequestMethod() !== 'POST') return;claimRequest();const respond = (status, body) => {
  setResponseStatus(status);
  setResponseHeader('content-type', 'application/json');
  setResponseBody(JSON.stringify(body || {}));
  returnResponse();
};const raw = getRequestBody();
if (!raw) return respond(400, { error: 'empty_body' });const payload = JSON.parse(raw);
if (!payload || typeof payload !== 'object') return respond(400, { error: 'invalid_json' });
if (!payload.event_name) return respond(400, { error: 'missing_event_name' });const u  = payload.user_data || {};
const p  = payload.page      || {};
const m  = payload.marketing || {};
const e  = payload.ecommerce || {};
const ui = payload.ui        || {};
const sf = payload.shopflo   || {};
const dv = payload.device    || {};const event = {
  // ─── Identity (top-level — read by every tag) ───────────────────────────
  event_name:    payload.event_name,
  event_id:      payload.event_id,
  event_time:    payload.event_time,
  merchant_id:   payload.merchant_id,
  session_id:    payload.session_id,
  channel:       payload.channel,
  source:        payload.source,  // ─── User identity (GA4 + Meta CAPI + Google Ads) ───────────────────────
  client_id:     u.client_id,
  user_id:       u.user_id,
  ga_session_id: u.ga_session_id,
  ip_override:   u.ip_address,
  user_agent:    u.user_agent,  // Hashed PII — keys that GA4/Meta CAPI/Google Ads tag templates read
  sha256_email_address: u.sha256_email,
  sha256_phone_number:  u.sha256_phone,
  sha256_first_name:    u.sha256_first_name,
  sha256_last_name:     u.sha256_last_name,
  sha256_city:          u.sha256_city,
  sha256_state:         u.sha256_state,
  sha256_zip:           u.sha256_zip,
  sha256_country:       u.sha256_country,  // Raw names (for tags that don't need hashing)
  first_name: u.first_name,
  last_name:  u.last_name,  // Meta CAPI click identifiers
  fbp: u.fbp,
  fbc: u.fbc,  // ─── Marketing / attribution ────────────────────────────────────────────
  gclid:        m.gclid,
  fbclid:       m.fbclid,
  utm_source:   m.utm_source,
  utm_medium:   m.utm_medium,
  utm_campaign: m.utm_campaign,
  utm_term:     m.utm_term,
  utm_content:  m.utm_content,  // ─── Page context ───────────────────────────────────────────────────────
  page_location: p.location,
  page_referrer: p.referrer,
  page_title:    p.title,  // ─── E-commerce (GA4 standard keys) ─────────────────────────────────────
  transaction_id: e.transaction_id,
  value:          e.value,
  currency:       e.currency,
  tax:            e.tax,
  shipping:       e.shipping,
  discount:       e.discount,
  coupon:         e.coupon,
  payment_type:   e.payment_type,
  items:          e.items,  // ─── Device ─────────────────────────────────────────────────────────────
  device_browser:       dv.browser_name,
  device_os:            dv.os_name,
  device_os_version:    dv.os_version,
  device_platform_type: dv.platform_type,  // ─── UI state ───────────────────────────────────────────────────────────
  current_step: ui.current_step,  // ─── Shopflo namespace (custom tags + raw passthrough) ──────────────────
  'x-shopflo': {
    merchant_id: payload.merchant_id,
    source:      payload.source,
    checkout_id: sf.checkout_id,
    token_id:    sf.token_id,
    order_id:    sf.order_id,
    brand_url:   sf.brand_url,
    raw:         payload
  }
};logToConsole('shopflo-client: accepted ' + payload.event_name);runContainer(event, function() { respond(204, {}); });

  1. Go to Clients → New → pick Shopflo S2S Client → set Priority to 100 → Save


Phase 3 — Create variables and triggers

~10 minutes

Variables — go to Variables → New → Event Data, create one per field:

Variable name

Key path

EvD - event_name

event_name

EvD - transaction_id

transaction_id

EvD - value

value

EvD - currency

currency

EvD - items

items

EvD - coupon

coupon

EvD - client_id

client_id

EvD - user_id

user_id

Triggers — go to Triggers → New → Custom Event (match type: Equals), one per event:

Trigger name

Event name

T - purchase

purchase

T - checkout_started

checkout_started

T - address_submitted

address_submitted

T - payment_initiated

payment_initiated

T - order_cancelled

order_cancelled

T - refund

refund

Add only the ones you need — you can always add more later.


Phase 4 — Add a destination tag (GA4 example)

~5 minutes

  1. Tags → New → Google Analytics: GA4

  2. Enter your Measurement ID (G-XXXXXXXXXX) — find this in GA4 under Admin → Data Streams

  3. Set Event Name to {{EvD - event_name}}

  4. Add event parameters:

Parameter name

Value

transaction_id

{{EvD - transaction_id}}

value

{{EvD - value}}

currency

{{EvD - currency}}

items

{{EvD - items}}

coupon

{{EvD - coupon}}

  1. Set Triggering to T - purchase (add other triggers as needed)

  2. Save the tag

Adding more destinations later (Meta CAPI, Google Ads, TikTok, etc.)? Just add a new tag. The client, variables, and triggers stay exactly the same.


Phase 5 — Publish and verify

~5 minutes

  1. Top right → Submit → Publish (Save alone does nothing — you must publish)

  2. Share the tagging server URL with Shopflo engineering — they'll configure it as the endpoint_url in your downstream config

  3. Verify: fire a test checkout and check GA4 → Reports → Realtime for the purchase event within ~30 seconds


Events Shopflo sends to your container

Event

Triggered when

checkout_started

Shopper opens Shopflo checkout

address_submitted

Shopper submits delivery address

payment_initiated

Shopper proceeds to pay

purchase

Order placed successfully

order_cancelled

Order is cancelled

refund

Refund is issued


Event payload reference

Full sample JSON payloads for each event. Use these to understand the complete data structure Shopflo sends, and to configure your tag variables.

checkout_initiated

{
  "event_name": "checkout_initiated",
  "event_id": "006757949f3d818a959ca0d9c1f52361",
  "event_time": 1781679878,
  "source": "shopflo-checkout",
  "merchant_id": "33107440-839a-41ea-a544-267d3be3d402",
  "session_id": "48b5bfee-2081-4b2c-9fc4-b75314d61fb0",
  "channel": "web",
  "user_data": {
    "user_id": "88e62459-703c-4c54-83e1-d05c2048e449",
    "client_id": "1039385143.1781634412",
    "marketing_consent": true,
    "first_name": "Shopflo",
    "sha256_email": "46da5c5513a4f5e78bc8abdfc06a4ed3c7ebc6f1a1f85be76d05c04bb7bbe700",
    "sha256_phone": "765cc6af4467fdad1e5a898ab4966c9af3e02676cbc369602c722e7f9f8be300",
    "sha256_first_name": "89abf0aaf131f0c191c84bf869df8a41ef2b45fdc12593c30a8692918d7a022d",
    "sha256_city": "577c568654b3877f7cae6b0f74a71b8f5cc09344595a88f4ca4183e73e469bba",
    "sha256_state": "545aab0ca555d5a4928e12170f013abd810652c9bd3ccd7892b619f6727d41ae",
    "sha256_zip": "4954c92131f719a04b2be348ee965bde394cb464f562f26f02e972b66de08995",
    "sha256_country": "fb54e9062429a93785559529beda15c55f62c29be22267811c0e8346c14846d3",
    "fbp": "",
    "fbc": "",
    "ip_address": "172.69.129.175",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
  },
  "page": {},
  "marketing": {
    "landing_page": "/",
    "landing_page_url": "https://prod-shopflo.myshopify.com/",
    "orig_referrer": "https://prod-shopflo.myshopify.com/pages/order-status",
    "brand_url": "https://prod-shopflo.myshopify.com"
  },
  "ecommerce": {
    "platform": "SHOPIFY",
    "status": "DRAFT",
    "value": 809.1,
    "subtotal": 899,
    "original_subtotal": 1398,
    "tax": 0,
    "shipping": 0,
    "discount": 89.9,
    "cod_charges": 0,
    "addon_total": 0,
    "total": 809.1,
    "total_payable": 819.1,
    "currency": "INR",
    "coupon": "COD2PREPAID",
    "coupons": ["COD2PREPAID"],
    "discount_codes": [{ "code": "COD2PREPAID", "amount": 89.9, "discount": 89.9, "source": "SHOPFLO", "is_prepaid": false, "is_freebie": false, "auto_applied": true, "coupon_id": "1181253b-73ec-4558-a137-938feebf5510", "title": "COD2PREPAID", "description": "on all orders", "header": "10% off", "coupon_type": "AMOUNT", "deduction_type": "PERCENTAGE", "concession_amount": 10 }],
    "payment_mode": null,
    "shipping_address": { "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "billing_address": { "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "affiliation": "Online Store",
    "items": [{ "item_id": "8273130782996", "item_name": "1+1 Satin Pillowcase Duo", "item_variant": "Default Title", "price": 899, "quantity": 1, "affiliation": "Online Store", "product_id": "8273130782996", "variant_id": "0", "sku": "PT-RENDM-2PC", "line_total": 899 }],
    "item_count": 1
  },
  "ui": { "long_session_id": "88e62459-703c-4c54-83e1-d05c2048e449", "segment_id": "4b308920-fda7-4b54-8798-a3036fc90069" },
  "shopflo": { "checkout_id": "4a7076c3-4438-4b93-bf42-82bb5356f842", "token_id": "f3cb7185-f2f2-4915-a6e5-380381e83a91", "brand_url": "https://prod-shopflo.myshopify.com", "channel": "Shopflo", "long_session_id": "88e62459-703c-4c54-83e1-d05c2048e449", "segment_id": "4b308920-fda7-4b54-8798-a3036fc90069", "customer_uid": "3d010755-3173-4b2a-b22e-22a2feec3382" }
}

login_completed

{
  "event_name": "login_completed",
  "event_id": "39b366a8e96c5621edc553d63d0974ff",
  "event_time": 1781679878,
  "source": "shopflo-checkout",
  "merchant_id": "33107440-839a-41ea-a544-267d3be3d402",
  "session_id": "48b5bfee-2081-4b2c-9fc4-b75314d61fb0",
  "channel": "web",
  "user_data": {
    "user_id": "88e62459-703c-4c54-83e1-d05c2048e449",
    "client_id": "1039385143.1781634412",
    "user_type": "cookie_login",
    "customer_type": "OLD",
    "auth_source": "SHOPFLO",
    "marketing_consent": true,
    "first_name": "Shopflo",
    "last_name": "yash",
    "full_name": "Shopflo yash",
    "sha256_email": "46da5c5513a4f5e78bc8abdfc06a4ed3c7ebc6f1a1f85be76d05c04bb7bbe700",
    "sha256_phone": "765cc6af4467fdad1e5a898ab4966c9af3e02676cbc369602c722e7f9f8be300",
    "sha256_first_name": "89abf0aaf131f0c191c84bf869df8a41ef2b45fdc12593c30a8692918d7a022d",
    "sha256_last_name": "262cc47030b1803064844b94c1cb0054a247d1e550e26bb33f215149d8b2c72e",
    "sha256_city": "577c568654b3877f7cae6b0f74a71b8f5cc09344595a88f4ca4183e73e469bba",
    "sha256_state": "545aab0ca555d5a4928e12170f013abd810652c9bd3ccd7892b619f6727d41ae",
    "sha256_zip": "4954c92131f719a04b2be348ee965bde394cb464f562f26f02e972b66de08995",
    "sha256_country": "fb54e9062429a93785559529beda15c55f62c29be22267811c0e8346c14846d3",
    "fbp": "",
    "fbc": "",
    "ip_address": "172.69.129.175",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
  },
  "device": { "browser_name": "Chrome", "os_name": "macOS", "os_version": "10.15.7", "platform_type": "desktop", "engine_name": "Blink", "is_iframe": true },
  "page": {},
  "marketing": { "landing_page": "/", "landing_page_url": "https://prod-shopflo.myshopify.com/", "orig_referrer": "http://retool.shopflo.co:3000/", "brand_url": "https://prod-shopflo.myshopify.com" },
  "ecommerce": {
    "platform": "SHOPIFY",
    "status": "DRAFT",
    "value": 69,
    "subtotal": 10,
    "original_subtotal": 8012,
    "tax": 1.52,
    "shipping": 50,
    "discount": 1,
    "cod_charges": 0,
    "addon_total": 0,
    "total": 69,
    "total_payable": 69,
    "currency": "INR",
    "coupon": "COD2PREPAID",
    "coupons": ["COD2PREPAID"],
    "discount_codes": [{ "code": "COD2PREPAID", "amount": 1, "discount": 1, "source": "SHOPFLO", "is_prepaid": false, "is_freebie": false, "auto_applied": true, "coupon_id": "1181253b-73ec-4558-a137-938feebf5510", "title": "COD2PREPAID", "description": "on all orders", "header": "10% off", "coupon_type": "AMOUNT", "deduction_type": "PERCENTAGE", "concession_amount": 10 }],
    "payment_mode": "",
    "shipping_address": { "address1": "rajesh davsadv", "address2": "wdfw", "phone": "+918830902422", "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "billing_address": { "address1": "rajesh davsadv", "address2": "wdfw", "phone": "+918830902422", "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "affiliation": "Online Store",
    "items": [{ "item_id": "8273131831572", "item_name": "Canvas Tote Bag (Limited Edition)", "item_variant": "Default Title", "price": 10, "quantity": 1, "affiliation": "Online Store", "product_id": "8273131831572", "variant_id": "45027358507284", "sku": "D1-DTMH-TOTEBAG_1416", "line_total": 10 }],
    "item_count": 1
  },
  "ui": { "current_step": "PAYMENTS", "long_session_id": "88e62459-703c-4c54-83e1-d05c2048e449", "segment_id": "4a7076c3-4438-4b93-bf42-82bb5356f842" },
  "shopflo": { "checkout_id": "4a7076c3-4438-4b93-bf42-82bb5356f842", "token_id": "183d5f44-5a31-47b7-b8e4-4b03df0ddde5", "cart_token": "cb0e97ec-c512-4ba0-be73-aadf0322b3d0", "abandoned_checkout_url": "https://checkout.shopflo.co/?tokenId=183d5f44-5a31-47b7-b8e4-4b03df0ddde5", "brand_url": "https://prod-shopflo.myshopify.com", "long_session_id": "88e62459-703c-4c54-83e1-d05c2048e449", "segment_id": "4a7076c3-4438-4b93-bf42-82bb5356f842", "customer_uid": "3d010755-3173-4b2a-b22e-22a2feec3382" }
}

address_selected

{
  "event_name": "address_selected",
  "event_id": "cbc22d34d779ae6da8c0a81c721c640f",
  "event_time": 1781764396,
  "source": "shopflo-checkout",
  "merchant_id": "33107440-839a-41ea-a544-267d3be3d402",
  "session_id": "2eb8c584-a949-4526-980c-9039f861c4f9",
  "channel": "web",
  "user_data": {
    "user_id": "06a189a1-06b6-4fea-b5d6-55e21e9521ec",
    "client_id": "120593787.1772438077",
    "user_type": "cookie_login",
    "customer_type": "OLD",
    "auth_source": "SHOPFLO",
    "marketing_consent": true,
    "first_name": "Jayanthi",
    "last_name": "Jayanthi",
    "full_name": "Jayanthi Jayanthi",
    "sha256_email": "fbde630d96b1f216db0498c23679539e7118762f1c2c2024c30fa10f3f5a0e10",
    "sha256_phone": "2ee21f2959609a3f6f3f88cbaabf0369472b5454dda7c1b6fe71ba569bdb4e47",
    "sha256_first_name": "048c251390745d103203f1cde3214c570aacc93dd04cfd90225a1c6da4c09b17",
    "sha256_last_name": "048c251390745d103203f1cde3214c570aacc93dd04cfd90225a1c6da4c09b17",
    "sha256_city": "c5508df96097559eba53e0301aaf688926e0c3c6c5568883defcc6823b6c9e3f",
    "sha256_state": "545aab0ca555d5a4928e12170f013abd810652c9bd3ccd7892b619f6727d41ae",
    "sha256_zip": "4fc81aec64d69bdec0ced192697366d218708791dd680524cf39dedd8e8ddf2a",
    "sha256_country": "fb54e9062429a93785559529beda15c55f62c29be22267811c0e8346c14846d3",
    "fbp": "",
    "fbc": "",
    "ip_address": "162.158.54.42",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
  },
  "device": { "browser_name": "Chrome", "os_name": "macOS", "os_version": "10.15.7", "platform_type": "desktop", "engine_name": "Blink", "is_iframe": true },
  "page": {},
  "marketing": { "landing_page": "/collections/all", "landing_page_url": "https://prod-shopflo.myshopify.com/collections/all", "orig_referrer": "https://prod-shopflo.myshopify.com/", "brand_url": "https://prod-shopflo.myshopify.com" },
  "ecommerce": {
    "platform": "SHOPIFY",
    "status": "DRAFT",
    "value": 30,
    "subtotal": 20,
    "original_subtotal": 16024,
    "tax": 0,
    "shipping": 0,
    "discount": 0,
    "cod_charges": 0,
    "addon_total": 0,
    "total": 30,
    "total_payable": 30,
    "currency": "INR",
    "coupon": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED",
    "coupons": ["NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED"],
    "discount_codes": [{ "code": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED", "amount": 0, "discount": 0, "source": "SHOPFLO", "is_prepaid": true, "is_freebie": false, "auto_applied": false, "title": "PREPAID", "header": "20% off", "coupon_type": "PREPAID", "deduction_type": "PERCENTAGE", "concession_amount": 20 }],
    "payment_mode": "",
    "shipping_address": { "address1": "316, 11th Cross Rd, Ejipura, Bengaluru, Karnataka 560047", "phone": "+919535461483", "city": "Bangalore", "province": "Karnataka", "province_code": "KA", "zip": "560047", "country": "India", "country_code": "IN" },
    "billing_address": { "address1": "316, 11th Cross Rd, Ejipura, Bengaluru, Karnataka 560047", "phone": "+919535461483", "city": "Bangalore", "province": "Karnataka", "province_code": "KA", "zip": "560047", "country": "India", "country_code": "IN" },
    "affiliation": "Online Store",
    "items": [{ "item_id": "8273131831572", "item_name": "Canvas Tote Bag (Limited Edition)", "item_variant": "Default Title", "price": 10, "quantity": 2, "affiliation": "Online Store", "product_id": "8273131831572", "variant_id": "45027358507284", "sku": "D1-DTMH-TOTEBAG_1416", "line_total": 20 }],
    "item_count": 2
  },
  "ui": { "current_step": "PAYMENTS", "long_session_id": "06a189a1-06b6-4fea-b5d6-55e21e9521ec", "segment_id": "4b308920-fda7-4b54-8798-a3036fc90069" },
  "shopflo": { "checkout_id": "6d4bab4d-33d9-4f8b-ac80-4e6561474b8b", "token_id": "bbac0175-634a-4d6d-b80f-0f7b63968c09", "abandoned_checkout_url": "https://checkout.shopflo.co/?tokenId=bbac0175-634a-4d6d-b80f-0f7b63968c09", "brand_url": "https://prod-shopflo.myshopify.com", "long_session_id": "06a189a1-06b6-4fea-b5d6-55e21e9521ec", "segment_id": "4b308920-fda7-4b54-8798-a3036fc90069", "customer_uid": "4d490012-06e4-43ed-9913-5fe8337152b1" }
}

payment_initiated

{
  "event_name": "payment_initiated",
  "event_id": "80bf9240e47a884041f860bf2121c28c",
  "event_time": 1781764404,
  "source": "shopflo-checkout",
  "merchant_id": "33107440-839a-41ea-a544-267d3be3d402",
  "session_id": "2eb8c584-a949-4526-980c-9039f861c4f9",
  "channel": "web",
  "user_data": {
    "user_id": "06a189a1-06b6-4fea-b5d6-55e21e9521ec",
    "client_id": "120593787.1772438077",
    "customer_type": "OLD",
    "marketing_consent": true,
    "first_name": "Jayanthi",
    "last_name": "Jayanthi",
    "sha256_email": "fbde630d96b1f216db0498c23679539e7118762f1c2c2024c30fa10f3f5a0e10",
    "sha256_phone": "2ee21f2959609a3f6f3f88cbaabf0369472b5454dda7c1b6fe71ba569bdb4e47",
    "sha256_first_name": "048c251390745d103203f1cde3214c570aacc93dd04cfd90225a1c6da4c09b17",
    "sha256_last_name": "048c251390745d103203f1cde3214c570aacc93dd04cfd90225a1c6da4c09b17",
    "sha256_city": "c5508df96097559eba53e0301aaf688926e0c3c6c5568883defcc6823b6c9e3f",
    "sha256_state": "545aab0ca555d5a4928e12170f013abd810652c9bd3ccd7892b619f6727d41ae",
    "sha256_zip": "4fc81aec64d69bdec0ced192697366d218708791dd680524cf39dedd8e8ddf2a",
    "sha256_country": "fb54e9062429a93785559529beda15c55f62c29be22267811c0e8346c14846d3",
    "fbp": "",
    "fbc": "",
    "ip_address": "162.158.54.42",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
  },
  "page": {},
  "marketing": { "landing_page": "/collections/all", "landing_page_url": "https://prod-shopflo.myshopify.com/collections/all", "orig_referrer": "https://prod-shopflo.myshopify.com/", "brand_url": "https://prod-shopflo.myshopify.com" },
  "ecommerce": {
    "platform": "SHOPIFY",
    "status": "PAYMENT_INITIATED",
    "value": 30,
    "subtotal": 20,
    "original_subtotal": 16024,
    "tax": 3.06,
    "shipping": 0,
    "discount": 0,
    "cod_charges": 0,
    "addon_total": 0,
    "total": 30,
    "total_payable": 30,
    "currency": "INR",
    "coupon": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED",
    "coupons": ["NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED"],
    "discount_codes": [{ "code": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED", "amount": 0, "discount": 0, "source": "SHOPFLO", "is_prepaid": true, "is_freebie": false, "auto_applied": true, "title": "PREPAID", "header": "20% off", "coupon_type": "PREPAID", "deduction_type": "PERCENTAGE", "concession_amount": 20, "max_discount": 4 }],
    "payment_type": "NETBANKING",
    "payment_mode": "NETBANKING",
    "pg_type": "CF",
    "shipping_address": { "address1": "316, 11th Cross Rd, Ejipura, Bengaluru, Karnataka 560047", "phone": "+919535461483", "city": "Bangalore", "province": "Karnataka", "province_code": "KA", "zip": "560047", "country": "India", "country_code": "IN" },
    "billing_address": { "address1": "316, 11th Cross Rd, Ejipura, Bengaluru, Karnataka 560047", "phone": "+919535461483", "city": "Bangalore", "province": "Karnataka", "province_code": "KA", "zip": "560047", "country": "India", "country_code": "IN" },
    "affiliation": "Online Store",
    "items": [{ "item_id": "8273131831572", "item_name": "Canvas Tote Bag (Limited Edition)", "item_variant": "Default Title", "price": 10, "quantity": 2, "affiliation": "Online Store", "product_id": "8273131831572", "variant_id": "45027358507284", "sku": "D1-DTMH-TOTEBAG_1416", "line_total": 20 }],
    "item_count": 2
  },
  "shopflo": { "checkout_id": "6d4bab4d-33d9-4f8b-ac80-4e6561474b8b", "token_id": "bbac0175-634a-4d6d-b80f-0f7b63968c09", "abandoned_checkout_url": "https://checkout.shopflo.co/?tokenId=bbac0175-634a-4d6d-b80f-0f7b63968c09", "brand_url": "https://prod-shopflo.myshopify.com", "channel": "Shopflo", "customer_uid": "4d490012-06e4-43ed-9913-5fe8337152b1" }
}

order_completed

{
  "event_name": "order_completed",
  "event_id": "29e5d9e680e4cbe9bcb218d776d36a19",
  "event_time": 1781634434,
  "source": "shopflo-checkout",
  "merchant_id": "33107440-839a-41ea-a544-267d3be3d402",
  "session_id": "2821af6d-7ddf-45fa-8efc-15b27cb2c90e",
  "channel": "web",
  "user_data": {
    "user_id": "3d010755-3173-4b2a-b22e-22a2feec3382",
    "client_id": null,
    "customer_type": "NEW",
    "marketing_consent": true,
    "first_name": "Shopflo",
    "last_name": "yash",
    "full_name": "Shopflo yash",
    "sha256_email": "46da5c5513a4f5e78bc8abdfc06a4ed3c7ebc6f1a1f85be76d05c04bb7bbe700",
    "sha256_phone": "765cc6af4467fdad1e5a898ab4966c9af3e02676cbc369602c722e7f9f8be300",
    "sha256_first_name": "89abf0aaf131f0c191c84bf869df8a41ef2b45fdc12593c30a8692918d7a022d",
    "sha256_last_name": "262cc47030b1803064844b94c1cb0054a247d1e550e26bb33f215149d8b2c72e",
    "sha256_city": "577c568654b3877f7cae6b0f74a71b8f5cc09344595a88f4ca4183e73e469bba",
    "sha256_state": "545aab0ca555d5a4928e12170f013abd810652c9bd3ccd7892b619f6727d41ae",
    "sha256_zip": "4954c92131f719a04b2be348ee965bde394cb464f562f26f02e972b66de08995",
    "sha256_country": "fb54e9062429a93785559529beda15c55f62c29be22267811c0e8346c14846d3",
    "fbp": "",
    "fbc": "",
    "ip_address": "2409:408c:840f:baed:f83d:a00c:37a4:aaba",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
  },
  "page": {},
  "marketing": { "landing_page": "/", "landing_page_url": "https://prod-shopflo.myshopify.com/", "brand_url": "https://prod-shopflo.myshopify.com" },
  "ecommerce": {
    "transaction_id": "#2655",
    "order_id": "7088706289940",
    "order_number": "#2655",
    "platform": "SHOPIFY",
    "status": "COMPLETED",
    "value": 20,
    "subtotal": 10,
    "original_subtotal": 8012,
    "tax": 1.52,
    "shipping": 0,
    "discount": 0,
    "cod_charges": 0,
    "addon_total": 0,
    "total": 20,
    "total_payable": 20,
    "currency": "INR",
    "coupon": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED",
    "coupons": ["NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED"],
    "discount_codes": [{ "code": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED", "amount": 0, "discount": 0, "source": "SHOPFLO", "is_prepaid": true, "is_freebie": false, "auto_applied": false, "title": "PREPAID", "header": "20% off", "coupon_type": "PREPAID", "deduction_type": "PERCENTAGE", "concession_amount": 20 }],
    "payment_type": "COD",
    "payment_mode": "COD",
    "shipping_address": { "address1": "rajesh davsadv", "address2": "wdfw", "phone": "+918830902422", "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "billing_address": { "address1": "rajesh davsadv", "address2": "wdfw", "phone": "+918830902422", "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "affiliation": "Online Store",
    "items": [{ "item_id": "8273131831572", "item_name": "Canvas Tote Bag (Limited Edition)", "item_variant": "Default Title", "price": 10, "quantity": 1, "affiliation": "Online Store", "product_id": "8273131831572", "variant_id": "45027358507284", "sku": "D1-DTMH-TOTEBAG_1416", "line_total": 10 }],
    "item_count": 1
  },
  "ui": { "long_session_id": "88e62459-703c-4c54-83e1-d05c2048e449", "segment_id": "4b308920-fda7-4b54-8798-a3036fc90069" },
  "shopflo": { "checkout_id": "c40bb6d8-5e99-417e-aeee-f5582a57e0b4", "token_id": "b82fe4e4-8d38-43bc-b71a-c2b600a08689", "order_id": "7088706289940", "abandoned_checkout_url": "https://checkout.shopflo.co/?tokenId=b82fe4e4-8d38-43bc-b71a-c2b600a08689", "order_tags": ["COD", "Shopflo"], "brand_url": "https://prod-shopflo.myshopify.com", "channel": "Shopflo", "long_session_id": "88e62459-703c-4c54-83e1-d05c2048e449", "segment_id": "4b308920-fda7-4b54-8798-a3036fc90069", "customer_uid": "3d010755-3173-4b2a-b22e-22a2feec3382" }
}

order_cancelled

{
  "event_name": "order_cancelled",
  "event_id": "a1df2d9aa9f7bf6ff370fe7f879aea59",
  "event_time": 1781763212,
  "source": "shopflo-checkout",
  "merchant_id": "33107440-839a-41ea-a544-267d3be3d402",
  "session_id": "48b5bfee-2081-4b2c-9fc4-b75314d61fb0",
  "channel": "web",
  "user_data": {
    "user_id": "88e62459-703c-4c54-83e1-d05c2048e449",
    "client_id": "1039385143.1781634412",
    "customer_type": "OLD",
    "marketing_consent": true,
    "first_name": "Shopflo",
    "last_name": "yash",
    "full_name": "Shopflo yash",
    "sha256_email": "46da5c5513a4f5e78bc8abdfc06a4ed3c7ebc6f1a1f85be76d05c04bb7bbe700",
    "sha256_phone": "765cc6af4467fdad1e5a898ab4966c9af3e02676cbc369602c722e7f9f8be300",
    "sha256_first_name": "89abf0aaf131f0c191c84bf869df8a41ef2b45fdc12593c30a8692918d7a022d",
    "sha256_last_name": "262cc47030b1803064844b94c1cb0054a247d1e550e26bb33f215149d8b2c72e",
    "sha256_city": "577c568654b3877f7cae6b0f74a71b8f5cc09344595a88f4ca4183e73e469bba",
    "sha256_state": "545aab0ca555d5a4928e12170f013abd810652c9bd3ccd7892b619f6727d41ae",
    "sha256_zip": "4954c92131f719a04b2be348ee965bde394cb464f562f26f02e972b66de08995",
    "sha256_country": "fb54e9062429a93785559529beda15c55f62c29be22267811c0e8346c14846d3",
    "fbp": "",
    "fbc": "",
    "ip_address": "172.69.122.166",
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36"
  },
  "page": {},
  "marketing": { "landing_page": "/", "landing_page_url": "https://prod-shopflo.myshopify.com/", "brand_url": "https://prod-shopflo.myshopify.com" },
  "ecommerce": {
    "platform": "SHOPIFY",
    "status": "COMPLETED",
    "value": 909,
    "subtotal": 899,
    "original_subtotal": 1398,
    "tax": 137.14,
    "shipping": 0,
    "discount": 0,
    "cod_charges": 0,
    "addon_total": 0,
    "total": 909,
    "total_payable": 909,
    "currency": "INR",
    "coupon": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED",
    "coupons": ["NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED"],
    "discount_codes": [{ "code": "NGEUSHYCTUMWBFHZIXRNGTESKIIJMKED", "amount": 0, "discount": 0, "source": "SHOPFLO", "is_prepaid": true, "is_freebie": false, "auto_applied": false, "title": "PREPAID", "header": "20% off", "coupon_type": "PREPAID", "deduction_type": "PERCENTAGE", "concession_amount": 20 }],
    "payment_mode": "",
    "shipping_address": { "address1": "rajesh davsadv", "address2": "wdfw", "phone": "+918830902422", "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "billing_address": { "address1": "rajesh davsadv", "address2": "wdfw", "phone": "+918830902422", "city": "Jammu", "province": "Karnataka", "province_code": "KA", "zip": "560102", "country": "India", "country_code": "IN" },
    "affiliation": "Online Store",
    "items": [{ "item_id": "8273130782996", "item_name": "1+1 Satin Pillowcase Duo", "item_variant": "Default Title", "price": 899, "quantity": 1, "affiliation": "Online Store", "product_id": "8273130782996", "variant_id": "45027353428244", "sku": "PT-RENDM-2PC", "line_total": 899 }],
    "item_count": 1
  },
  "shopflo": { "checkout_id": "1f166a23-b8a2-4ca0-a6d5-dd32fd209224", "token_id": "6cc1afbb-7cce-488a-8c06-822515f08b5a", "abandoned_checkout_url": "https://checkout.shopflo.co/?tokenId=6cc1afbb-7cce-488a-8c06-822515f08b5a", "brand_url": "https://prod-shopflo.myshopify.com", "channel": "Shopflo", "customer_uid": "3d010755-3173-4b2a-b22e-22a2feec3382" }
}


Troubleshooting

Symptom

Fix

Getting a 400 response

Check that the container version is published and the client priority is set to 100

Getting a 404

The request path doesn't match — confirm it's set to /shopflo/event

Events not showing in GA4 Realtime

Double-check the Measurement ID and confirm the tag is firing in GTM Preview

items missing from GA4

Ensure items is passed as an array of objects, not a string

Tag changes not taking effect

You saved but didn't publish — hit Submit → Publish


What to hand off to Shopflo engineering

Once your container is live, share:

  • The tagging server URL

  • Confirm the endpoint path is /shopflo/event

  • Any auth token if you've added one (optional for testing, recommended for production)


Deleting a GTM container or account

Delete a container

Use this if you want to remove a specific container (e.g. a test container) while keeping your GTM account.

Warning: Deleting a container is permanent. All tags, triggers, variables, and published versions inside it will be lost.

  1. Go to tagmanager.google.com and open the account

  2. On the container card, click the three-dot menu (⋮)Container settings

  3. Scroll to the bottom → click Delete container

  4. Type the container name to confirm → Delete

Also shut down the associated Cloud Run / App Engine instance in GCP to stop incurring hosting costs:

Delete a GTM account

Use this only if you want to remove GTM entirely. This deletes all containers and all data inside them.

Warning: This is irreversible. All containers, tags, triggers, variables, and history under the account will be permanently deleted.

  1. Click the three-dot menu (⋮) next to the account name → Account settings

  2. Scroll to the bottom → click Delete account

  3. Confirm by typing the account name → Delete

Before you delete — checklist

Notify Shopflo engineering so they can remove the endpoint_url from your downstream config

Delete or reassign the Cloud Run / App Engine instance in GCP to avoid ongoing charges

Export any tag/container configuration you may want to reference later (Admin → Export container)

Remove the GTM tagging server URL from any Shopflo merchant config

Did this answer your question?