Introduction
Server-side tracking provides reliable conversion tracking that isn't blocked by ad-blockers or browser restrictions. This guide covers essential best practices for implementing server-side tracking effectively.
Event Timing
Fire events at the right time for accurate tracking:
- ViewContent: Fire when page content is fully loaded and displayed
- AddToCart: Fire immediately after item is successfully added to cart
- InitiateCheckout: Fire when user enters checkout page or clicks checkout button
- Purchase: Fire on order confirmation page, after successful payment
Key Principle: Fire events after actions complete successfully, not before.
Data Accuracy
Ensure accurate event data:
- Correct Values: Use actual transaction values, not estimates
- Currency Codes: Use proper 3-letter ISO currency codes (USD, EUR, etc.)
- Product IDs: Use consistent product ID format across all events
- Transaction IDs: Use unique transaction IDs for Purchase events
- User Data: Collect and include user data (email, phone) when available
Parameter Structure
Follow standard parameter structures:
- Required Parameters: Always include required parameters for each event type
- Data Types: Use correct data types (numbers for values, strings for IDs, arrays for lists)
- Consistent Naming: Use standard parameter names consistently
- Complete Data: Include all relevant parameters for better tracking quality
User Data Collection
Collect user data strategically:
- At Checkout: Best time to collect complete user information
- Email & Phone: Most important for event matching (include when available)
- Additional Fields: Include names, location when they improve matching
- Proper Formatting: Normalize data (lowercase, trimmed) before sending
Testing Procedures
Test your implementation thoroughly:
- Test Events: Use test event codes in Facebook/TikTok to verify events
- Check Logs: Review Event Logs in dashboard to verify events are received
- Platform Verification: Check Events Manager to ensure events appear correctly
- Deduplication Testing: Verify events are deduplicated correctly
Error Handling
Implement proper error handling:
- Network Errors: Handle network failures gracefully
- Validation Errors: Check for validation errors in Event Logs
- Rate Limiting: Be aware of event limits and handle gracefully
- Logging: Log errors for debugging without breaking user experience
Performance Optimization
Optimize for performance:
- Async Loading: Load tracking script asynchronously
- Non-Blocking: Don't block page load for tracking calls
- Efficient Batching: Send events efficiently without overwhelming the server
- Minimize Payload: Only include necessary data in events
Security Considerations
Keep your implementation secure:
- Authentication Key: Keep authentication key secure (don't expose in client-side code if possible)
- HTTPS Only: Use HTTPS for all tracking endpoints
- User Privacy: Respect user privacy and GDPR requirements
- Data Hashing: ServerTrack handles PII hashing automatically
Monitoring and Maintenance
Monitor your tracking implementation:
- Event Logs: Regularly check Event Logs for errors or issues
- Event Status: Monitor event status (queued, sent, failed, blocked)
- Platform Reports: Compare ServerTrack logs with platform reports
- Usage Tracking: Monitor event usage against your plan limits
Best Practices Summary
- Fire events at the right time - after actions complete
- Ensure data accuracy - use correct values and formats
- Include user data - improve event matching quality
- Test thoroughly - verify implementation before going live
- Monitor regularly - check logs and reports for issues
- Optimize performance - don't impact user experience
Summary
Server-side tracking best practices:
- Fire events at the correct timing (after actions complete)
- Ensure data accuracy (correct values, formats, IDs)
- Collect and include user data for better matching
- Test thoroughly before and after deployment
- Monitor logs and reports regularly
- Optimize for performance and security
Following these best practices ensures reliable, accurate server-side tracking.