Server-Side GTM Implementation Prompt
Context
Use this prompt to implement server-side tracking with Stape hosting, sGTM container, and event routing to GA4 and advertising platforms. Improves data accuracy, reduces ad blocker impact, and provides privacy-first tracking.
Prerequisites
- Stape account and tagging server
- GTM web container already set up
- Server GTM container access
- Custom loader domain configured
See Stape Tool Documentation and sGTM patterns.
Prompt Template
I need to implement server-side tracking for a client with the following setup:
**Current Setup:**
- Website: [WEBSITE_URL]
- Web GTM: [GTM_WEB_ID]
- Stape tagging server: [STAPE_SERVER_URL] (e.g., data.pacing.agency)
- Custom loader: [LOADER_URL] (e.g., load.data.pacing.agency)
**Server Container:**
- Server GTM ID: [GTM_SERVER_ID] (or "Create new")
- GA4 Measurement ID: [GA4_ID]
- Destinations: [DESTINATIONS] (GA4/Google Ads/Meta/LinkedIn)
**Requirements:**
- Client ID persistence: [CLIENT_ID_STRATEGY] (Cookie/_c_pca localStorage)
- IP anonymization: [IP_ANON] (Yes/No)
- Server-side tagging: [EVENTS_TO_ROUTE] (All/Specific events)
- BigQuery streaming: [BIGQUERY] (Yes/No - dataset details)
Please provide:
1. **Web container modifications** for server-side routing
2. **Server container configuration** with clients and tags
3. **Client ID management** setup
4. **Testing and validation** steps
5. **BigQuery integration** (if applicable)
Follow Pacing Agency sGTM patterns from existing implementations.
Expected Output
See full implementation in Stape Tool Documentation.
Key components:
- Stape custom loader:
https://load.data.pacing.agency/... - Web container: Server URL variable, GA4 tag routing
- Server container: GA4 client, GA4 tag, BigQuery tag
- Client ID: Stored in
_c_pca(localStorage first, cookie fallback)
Success Criteria
✅ Custom loader installed and working
✅ Events flowing through sGTM
✅ GA4 receiving server-side events
✅ Client ID consistent
✅ BigQuery capturing events (if applicable)
✅ Ad blocker bypass working
Last updated: 2026-01-07
Estimated time: 2-3 hours