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

Shopflo supports server-side Google Tag Manager (sGTM) integration. Instead of relying on browser-side pixels that get blocked by ad blockers or delayed by page load, Shopflo sends checkout events directly from the server to your GTM container — giving you more reliable, accurate data across all your destinations.

How it works: Shopflo sends a single HTTPS POST to your GTM server container. The container receives it via a custom client and fans the data out to any destination you configure — GA4, Meta CAPI, Google Ads, TikTok, and more.

One inbound POST → one client → many destinations.

⚠️ 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. Total setup time: ~30 minutes.


Phase 1 — Create the GTM Server Container (~5 min)

Step 1: Go to tagmanager.google.comCreate AccountCreate Container.

Step 2: Set the platform to Server.

Step 3: Choose Automatically provision tagging server → select your GCP project and region → Create.

Step 4: Wait 3–5 minutes. Once provisioning completes, copy the tagging server URL. It will look like:

You'll need this URL at the end — keep it handy.


Phase 2 — Add the Shopflo S2S Client (~10 min)

Step 1: In your container, go to Templates → Client Templates → New.

Step 2: Name it Shopflo S2S Client.

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

  • Display name: Request path

  • Name: requestPath

  • Default value: /shopflo/event

Step 4: In the Code tab, paste the Shopflo client code provided by Shopflo engineering. Save the template.

Step 5: Go to Clients → New → pick Shopflo S2S Client → set Priority to 100 → Save.


Phase 3 — Create Variables and Triggers (~10 min)

Variables — go to Variables → New → Event Data, create one variable 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 events you need — you can always add more later.


Phase 4 — Add a Destination Tag (GA4 Example) (~5 min)

Step 1: Go to Tags → New → Google Analytics: GA4.

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

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

Step 4: Add event parameters:

Parameter name

Value

transaction_id

{{EvD - transaction_id}}

value

{{EvD - value}}

currency

{{EvD - currency}}

items

{{EvD - items}}

coupon

{{EvD - coupon}}

Step 5: Set Triggering to T - purchase (add other triggers as needed) → Save.

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 min)

Step 1: Top right → Submit → Publish. Saving alone does nothing — you must publish for changes to take effect.

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

Step 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


Troubleshooting

Symptom

Fix

Getting a 400 response

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

Getting a 404

Request path mismatch — 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 following with Shopflo engineering:

  • Your tagging server URL

  • Confirm the endpoint path is /shopflo/event

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


Need more help? Reach out to us at support@shopflo.com

Did this answer your question?