Building a custom CDP and enriching event data using server-side GTM

Written by

Ira Holubovska

Updated Sep 12, 2025 comments

How the schema of CDP on sGTM looks like

Components needed

The flow description

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.
This is how user data flows from the data source (CRM) to CDP - Stape

A brief overview of the required steps:

Ways of sending data to sGTM

  1. 1.
  2. 2.
  3. 3.
  4. 4.
  5. 5.

Receive data in sGTM

  1. 1.
  2. 2.
  3. 3.

Merge users into a customer profile

1. User ID

2. User data stitching

how the read flow looks like - Stape
how the merge flow looks like - Stape

Send data

Debug

The setup

Use case 1: Enrich the pageview event with the user data stored on the purchase event.

user-id power-up by stape
variable configuration - stape
stape store writer tag
stape store feature
stape store lookup variable
stape store lookup variable
Add a lookup variable to the pageview tag - Stape
You should see enriched user data in the tag triggered in the sGTM container - Stape

Use case 2: Store click ID and push it on events when click ID is unavailable.

gtm server-side for wordpress - stape
data client configuration - stape
X-Gtm-Server-Preview HTTP header - stape
http header config - stape
http header config - stape
restore variable configuration - stape
transformation configuration - stape
stape store configuration
facebook conversion api configuration - stape
transformation configuration - stape
variable configuration - stape
testing the setup - stape
testing the setup 2 - stape

Conclusion

Would like to try server-side tracking?

Try for free

Written by

Ira Holubovska

Content writer

Ira has 10+ years of digital marketing experience, with the last 5 focused on server-side tracking. She understands how and when it works across various digital marketing scenarios.

Was this article helpful?

Comments

Recommended for you

Turn better tracking into better marketing performance

Try for free