Google Tag Manager (GTM) Server-Side Tagging with Lytical
Send events to Lytical from your Google Tag Manager Server container.
What is GTM Server-Side? GTM Server-Side tagging routes all your analytics and marketing tags through your own server infrastructure. This provides first-party tracking, unified data layer, better control over data, and improved privacy.
Prerequisites
- A GTM Server container set up and running
- A Lytical account with a site configured
- Your Lytical site token (found in Settings → Website)
Setup Instructions
Step 1: Download the Tag Template
Download the Lytical tag template file: lytical-tag-template.tpl
Step 2: Import the Template
- Open your GTM Server container
- Go to Templates → Tag Templates
- Click New
- Click the three dots menu → Import
- Select the downloaded
.tplfile - Save the template
Step 3: Create a New Tag
- Go to Tags → New
- Select Lytical Analytics as the tag type
- Configure the tag:
- Site Token: Your Lytical site token (required)
- Event Type: Select the type of event
- Custom Properties: Add any additional data
Step 4: Set Up Triggers
Create triggers based on your tracking needs:
For Page Views:
- Trigger type: Client → Page View
- Fires on all page views
For Custom Events:
- Trigger type: Custom
- Configure based on your event name
Step 5: Test and Deploy
- Use Preview mode to test your setup
- Verify events appear in Lytical dashboard
- Publish your container
Event Types
Page View
Tracks page visits with URL, title, and referrer.
Event Type: Page View — No additional configuration needed
Custom Event
Tracks custom interactions like button clicks, form submissions, etc.
Event Type: Custom Event — Set Custom Event Name (e.g., "Add to Cart", "Signup")
Identify
Associates a visitor with a known user ID.
Event Type: Identify — Set User ID and optional properties (email, plan, etc.)
Data Mapping
The tag automatically maps common GA4/GTM event data:
| GTM Server Data | Lytical Field |
|---|---|
page_location |
url |
page_path |
path |
page_referrer |
referrer |
page_title |
title |
user_agent |
user_agent |
client_id |
session_id |
utm_source |
utm.source |
utm_medium |
utm.medium |
utm_campaign |
utm.campaign |
gclid |
gclid |
fbclid |
fbclid |
Custom Properties
Add custom properties to any event using the Custom Properties table in the tag configuration:
| Property Name | Property Value |
|---|---|
product_id |
|
price |
|
category |
|
Use GTM variables to dynamically populate values.
Advanced Configuration
Custom Endpoint
If you're using a first-party proxy for Lytical, update the Endpoint URL field to your proxy URL (e.g., https://yoursite.com/t/events).
Server-Side Enrichment
You can enrich events before sending to Lytical by:
- Creating a transformation in your GTM Server container
- Adding data to the event object
- The Lytical tag will include any additional data in the
propertiesobject
Troubleshooting
Events not appearing in Lytical?
- Check the GTM Server logs for errors
- Verify your site token is correct
- Use Preview mode to inspect the request/response
Missing data fields?
- Ensure your GTM Web container is sending the expected data
- Check the data layer for the fields you need
- Verify your triggers are firing correctly
Authentication errors?
- The Lytical endpoint is public (site token is the auth)
- No API key or additional auth is needed
Client-Side vs Server-Side Comparison
| Feature | Client-Side (lyt.js) | Server-Side (GTM) |
|---|---|---|
| Setup complexity | Easy | Moderate |
| First-party tracking | Requires proxy | Built-in |
| Data control | Limited | Full |
| Server costs | None | $50-500+/mo |
| Features | Full autocapture | Manual config |
| Maintenance | None | Server upkeep |
Recommendation: Use server-side if you already have GTM Server for other tags. Otherwise, use lyt.js with a first-party proxy for the best balance of features and simplicity.
Need help? Contact support@lytical.ai or visit our help center.