Webhooks are a powerful way to send event data from external systems to your server-side Google Tag Manager (sGTM) container.
They’re commonly used for:
- Offline store purchases
- CRM updates
- Payment confirmations
- Subscription events
- Backend order systems
However, there’s one common challenge:
Many webhooks send data in XML format, while server-side GTM works best with JSON.
If you want clean, compatible data inside your server container, here’s how to automatically convert webhook data from XML to JSON using the XML to JSON power-up inside Stape.
Why You Should Convert XML to JSON in sGTM
Server-side GTM runs in a JavaScript environment.
JSON (JavaScript Object Notation) is:
- Natively compatible with JavaScript
- Easier to parse
- Easier to map into variables
- Simpler to use in tags and triggers
XML, on the other hand:
- Requires manual parsing
- Is harder to extract values from
- Often needs custom code
- Can complicate webhook handling
Instead of writing custom logic to transform XML payloads, you can automate the conversion.
When This Is Useful
You should use XML to JSON conversion if:
- Your webhook payload arrives in XML format
- You’re receiving data from legacy systems
- Your offline store system sends XML
- Your payment provider sends XML responses
- Your CRM integration uses XML
For example, your webhook might send this:
<order>
<transaction_id>12345</transaction_id>
<value>120.00</value>
<currency>USD</currency>
</order>
But your server container works more smoothly with:
{
“transaction_id”: “12345”,
“value”: “120.00”,
“currency”: “USD”
}
The XML to JSON power-up handles this automatically.
How to Convert Webhook XML Data to JSON Automatically
Follow these steps to enable automatic conversion inside Stape.
Step 1: Log in to Your Stape Account
Register or log in to your Stape account.
The XML to JSON power-up is available for free, regardless of your Stape plan.
Step 2: Open Power-Ups
- Go to Stape Admin
- Navigate to the Power-Ups section
- Click Use next to XML to JSON
Step 3: Activate the Power-Up
- Click Turn on to activate power-up
- Click Save changes
Once activated, Stape will automatically convert incoming XML webhook payloads into JSON format before processing them in your server container.
No custom coding required.
What Happens After Activation?
After enabling the power-up:
- Incoming webhook data in XML format is converted automatically
- Your sGTM container receives clean JSON
- Variables can be mapped easily
- Tags can fire without additional parsing logic
This makes webhook integrations significantly cleaner and more stable.
Benefits of Using XML to JSON Power-Up
Using this power-up provides:
✔ Automatic XML to JSON conversion
✔ No manual parsing required
✔ Cleaner variable mapping
✔ Better compatibility with server GTM
✔ Faster webhook implementation
Instead of debugging XML structures, you can focus on building reliable tracking logic.
Example Use Case: Offline Purchase Tracking
Imagine you run an offline store system that sends daily purchase data via webhook in XML format.
Without conversion:
- You must write custom templates
- Extract values manually
- Risk formatting errors
With XML to JSON enabled:
- The payload is converted instantly
- You can map transaction_id, value, and currency directly
- You can send the purchase event to platforms like Google Analytics 4 without additional complexity
It simplifies the entire workflow.
Final Thoughts
Working with webhooks should not require complex parsing logic.
If your external system sends XML data, you don’t need to rebuild your server container or write custom code.
Simply:
- Enable the XML to JSON power-up in Stape
- Save changes
- Let it convert webhook data automatically
It’s a simple solution that makes your server-side GTM setup cleaner, faster, and easier to manage.
