How to Send Lead Data with UTM Parameters via Webhooks
This guide explains how to capture and forward lead generation data, including UTM parameters and marketing attribution data, to external platforms using webhooks through Google Tag Manager Server-Side.
Overview
When a visitor converts on your website, you often want to send this conversion data along with marketing attribution information to external platforms for further processing, CRM integration, or automation workflows.
What Data Can Be Captured?
Lead Information
- Form submission data (name, email, phone, etc.)
- User behavior data
- Page information where conversion occurred
- Timestamp of conversion
Marketing Attribution Data
- UTM Parameters: utm_source, utm_medium, utm_campaign, utm_term, utm_content
- Platform Tracking IDs: Google Click ID (gclid), Facebook Click/Browser ID (fbc/fbp), TikTok Click ID (ttclid)
- Session Data: Session ID, session count, user agent
- Traffic Source: Referrer URL, landing page
Setting Up Webhook Integration
Prerequisites
- Google Tag Manager Server-Side container configured
- AdPage tracking implementation on your website
- Webhook endpoint from your chosen platform (Zapier, Make, or N8N)
Step 1: Configure the Webhook Client
You can download and import the Webhook client by going to this URL: GitHub AdPage Webhook client
The AdPage Webhook Client automatically parses incoming lead data and structures it for forwarding. It handles:
javascript
// Example of parsed data structure
{
"event_name": "trytagging_generate_lead",
"form_data": {
"name": "John Doe",
"email": "john@example.com",
"phone": "+1234567890"
},
"marketing": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "summer-sale",
"gclid": "abc123...",
"fbp": "fb.1.1234567890",
"user_agent": "Mozilla/5.0...",
"ip": "192.168.1.1"
},
"user_data": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1234567890"
}
}
Step 2: Create HTTP Request Tag
Configure the JSON HTTP Request tag to forward data to your chosen platform:
- URL: Your webhook endpoint URL
- Method: POST
- Headers: Content-Type: application/json
- Body: Include form_data and marketing variables
You can download or use the Gallery feature of Google Tag Manager server side to use the HTTP request tag of Stape: HTTP request tag
Step 3: Set Up Trigger
Create a trigger that fires when lead data is received:
- Trigger Type: Custom Event or Always
- Conditions:
- Event Name contains "generate_lead" or similar
- Client Name contains "Webhook"
Testing Your Setup
1. Use GTM Preview Mode
- Enable preview mode in GTM and use Webhook testing
- Submit a test form on your website
- Verify the webhook tag fires correctly
- Check the data being sent
2. Webhook Testing Tools
- Webhook.site: Create temporary webhook URLs for testing
- Postman: Test webhook endpoints manually
- Platform test features: Most platforms offer webhook testing utilities
3. Verify Data Reception
- Check your chosen platform's webhook logs
- Verify all expected fields are received
- Test data formatting and structure
Troubleshooting
Common Issues
Webhook Not Firing:
- Check trigger conditions
- Verify event names match
- Ensure client is properly configured
Missing Data:
- Verify variable configurations
- Check data layer implementation
- Confirm marketing data is being captured
Platform Integration Issues:
- Validate webhook URL format
- Check authentication requirements
- Verify platform-specific payload structure
Debugging Tips
- Enable Logging: Set log type to "Always log to console"
- Use Debug Headers: Add trace-id for request tracking
- Test Incrementally: Start with basic data, add complexity gradually
- Monitor Response Codes: Check for 200 OK responses
Security Considerations
Data Protection
- Only send necessary data fields
- Consider data encryption for sensitive information
- Implement proper access controls on webhook endpoints
Webhook Security
- Use HTTPS endpoints only
- Implement webhook signature verification when available
- Set up proper authentication headers
Best Practices
- Error Handling: Configure timeout and retry logic
- Data Validation: Validate data before sending
- Monitoring: Set up alerts for failed webhooks
- Documentation: Maintain clear documentation of data mappings
- Testing: Regularly test webhook functionality
Conclusion
Webhook integration allows you to seamlessly forward lead data with complete marketing attribution to your preferred automation platforms. By following this guide, you can ensure comprehensive lead tracking that maintains the full customer journey context from first click to conversion.
For technical support or advanced configurations, contact your implementation team or refer to platform-specific documentation.
Updated on: 06/08/2025
Thank you!