UChat Official

Introduction

In today's digital marketing landscape, understanding the origin of your website traffic is crucial for optimizing campaigns, measuring ROI, and effectively managing affiliate partnerships.

This detailed tutorial provides a step-by-step approach to tracking UTM parameters and affiliate traffic sources during user sign-ups.

Designed primarily for partners using a specific sign-up page, the guide explains how to implement tracking mechanisms that capture detailed traffic data and send it to your backend via webhooks. Whether deploying on your main website or partner subdomains, this method ensures comprehensive data collection, enabling precise attribution and performance analysis.

Step-by-Step Setup for UTM and Affiliate Traffic Tracking

1. Prerequisites and Tools Needed

Component

Description

Notes

HTML Script Add-on

A custom script to collect UTM parameters

Available in partner settings, one-time payment

Google Tag Manager (GTM)

For deploying and managing scripts and triggers

Free tool, widely used

Webhook URL

Endpoint to receive collected data

Can be built-in or third-party (e.g., Zapier, Make)

Partner API Webhook

Receives user registration data with parameters

Must be configured to accept incoming data

2. Installing the HTML Script Add-on

  • Access Partner SettingsCustom Add-ons.

  • Purchase and install the HTML script add-on.

  • This script will be responsible for capturing UTM parameters, referral info, landing pages, and visit counts.

3. Integrating Google Tag Manager

  • Install GTM Script: Follow tutorial videos for proper setup.

  • Create Variables:

    • UTM Source: Query parameter utm_source.

    • GCL ID: For Google Ads traffic.

    • Additional Parameters: Custom keys for affiliate codes or other tracking info.

  • Create Triggers:

    • Landing Page Trigger: Fires when a user first arrives (referral not from your domain).

    • UTM Tag Trigger: Fires when URL contains UTM parameters.

    • Sign-up Page Trigger: Fires on registration page (URL contains "register" or similar).

4. Configuring the Script for Custom Domains

  • Locate the variable uf.domain in the script.

  • Replace it with your root domain (e.g., yourdomain.com).

  • This ensures the script correctly identifies traffic sources across your website and partner subdomains.

5. Customizing UTM and Affiliate Parameters

  • Default Tracking:

    • UTM parameters (utm_source, utm_medium, utm_campaign) are automatically captured.

  • Adding Extra Parameters:

    • Affiliate codes or unique identifiers provided by your partners.

    • Ensure the key in the script matches the URL parameter key.

    • Values should start with UC (e.g., UC12345) to be recognized.

  • Example URL:

6. Setting Up Triggers in GTM

  • Landing Page Trigger:

    • Fires when referral is external (referrer not your domain).

    • Ensures capturing traffic from ads, emails, or other sources.

  • UTM Tag Trigger:

    • Fires when URL contains utm_source or gcl_id.

  • Sign-up Trigger:

    • Fires on registration page load (page URL contains "register").

    • Ensures hidden form fields are populated before submission.

7. Creating the Tag in GTM

  • Script Tag:

    • Paste the customized script.

    • Connect it with the four triggers:

      • Landing page trigger

      • UTM tag trigger

      • Google Ads trigger

      • Sign-up page trigger

  • Publish the container after testing.

8. Testing the Implementation

  • Generate Test Links:

    • Append UTM parameters and affiliate codes.

    • Example:

  • Verify Cookies:

    • Use browser console (ApplicationCookies) to check stored UTM data.

  • Inspect Hidden Form Fields:

    • On the registration page, ensure hidden inputs are prefilled with correct values.

  • Complete Registration:

    • Submit form and verify webhook payload.

9. Webhook Configuration and Data Reception

  • Set Up Webhook URL:

    • Use your server or third-party services like Zapier or Make.

  • Configure Partner API:

    • Ensure it receives and logs data such as:

      • UTM source

      • Affiliate code

      • Referral info

      • Landing page URL

      • Visit count

  • Monitor Incoming Data:

    • Check logs or dashboards to confirm data accuracy.

10. Analyzing and Using Collected Data

  • Data Storage:

    • Save webhook payloads into databases or Google Sheets.

  • Attribution:

    • Identify which traffic sources or affiliates generate the most sign-ups.

  • Campaign Optimization:

    • Adjust marketing efforts based on performance metrics.

  • Affiliate Management:

    • Track individual affiliate contributions via unique codes.

Outro: Final Tips and Best Practices

  • Ensure Valid SMTP Profiles: For email notifications, verify SMTP setup to prevent missed registration alerts.

  • Consistent Parameter Naming: Use uniform keys for extra parameters to simplify data analysis.

  • Test Regularly: Always verify data collection after updates or changes.

  • Secure Webhook Endpoints: Protect your webhook URLs from unauthorized access.

  • Document Your Setup: Maintain clear records of parameters, triggers, and scripts for future reference.

  • Leverage Data for Growth: Use insights from UTM and affiliate tracking to refine marketing strategies and maximize ROI.

Summary Table: Key Components and Their Roles

Component

Purpose

Implementation Notes

HTML Script Add-on

Collects UTM, referral, and custom parameters

Installed via partner settings

Google Tag Manager

Manages triggers and scripts

Create variables, triggers, and tags

Webhook URL

Receives data on user registration

Use built-in or third-party services

Custom Parameters

Track affiliate codes or other info

Keys start with UC, values with UC

Final Words

Implementing robust UTM and affiliate tracking is essential for understanding your traffic sources and optimizing your marketing efforts. By following this comprehensive guide, you can accurately capture detailed user journey data, attribute sign-ups to specific campaigns or partners, and leverage this information to drive smarter decisions. Remember, meticulous setup, thorough testing, and continuous monitoring are the keys to successful tracking and attribution.