TG-Staff 团队 avatar TG-Staff 团队

TG Diversion Link Complete Guide: Generation, Redirect Bot & Ad Attribution

tg-diversion-link pillar TG Diversion Link

TG Diversion Links (Magic Links) Complete Guide: Generation, Redirect Bot & Ad Attribution

If you run a Telegram Bot for customer support or sales, you’re probably used to pasting your Bot’s t.me/your_bot?start=xxx link directly on social media, ads, or your website. But have you ever wondered: Which channel did users clicking these links come from? What are their IP addresses and browser info? Can you capture this data before they jump to the Bot, for ad attribution and session routing?

That’s exactly the core problem TG Diversion Links (Magic Links) solve. This article uses TG-Staff as an example, covering the principles and practice of generating diversion links, parameter capture, session assignment, and multi-channel tracking, to help you boost your Telegram Bot customer support efficiency.

A TG Diversion Link, also called a Magic Link, is a special short link (e.g., https://app.tg-staff.com/{code}). Unlike normal Bot links that directly redirect to a Telegram Bot, diversion links first go through TG-Staff’s server, where they capture the visitor’s IP address, browser info, and URL parameters before redirecting the user to your Telegram Bot.

Simply put, it acts as a smart springboard: User clicks → Data recorded → Redirect to Bot → Auto-reply → Human agent takes over.

Key differences from normal Bot links:

FeatureNormal Bot Link (t.me/...)Diversion Link (app.tg-staff.com/...)
Data captureNone; Telegram doesn’t provide source infoCaptures IP, browser UA, URL tracking parameters
Ad attributionCan’t distinguish channelsCan distinguish utm_source, campaign, etc.
Session routingRelies on Bot-internal logicSupports TG-Staff project-level routing rules
Redirect experienceDirectly redirects to BotRecords first, then redirects; latency nearly imperceptible

For cross-border, overseas, and Web3 teams, diversion links are a key tool to bridge ad campaigns → Bot conversions → human customer support.

When a user clicks a diversion link, the following sequence occurs:

  1. User clicks the diversion link (e.g., https://app.tg-staff.com/XyZ123 from an ad)
  2. TG-Staff server receives the request and logs:
    • User IP address
    • Browser User-Agent (device, OS, browser type)
    • All query parameters in the URL (e.g., ?utm_source=google&utm_campaign=spring_sale)
  3. Server issues a 302 redirect to the Bot’s t.me/... link or a specified deep link within the Bot
  4. User enters the Bot, triggering a welcome message or auto-reply flow (e.g., menu, form, etc.)
  5. Session routing system assigns the user to an online agent (or enters a waiting queue) based on project routing rules
  6. Agent sees user info in the TG-Staff web console, including the captured source data, and begins the conversation

What Parameters Are Captured?

Key fields captured by TG-Staff diversion links:

  • IP address: For approximate geographic location (not precise, only for attribution reference)
  • User-Agent: Browser, OS, device type
  • URL tracking parameters: Supports all standard UTM parameters (utm_source, utm_medium, utm_campaign, utm_term, utm_content) and custom parameters (e.g., campaign_id, channel, ref)

This data appears in the session details page and user profile in the TG-Staff backend, where you can filter and export by parameter dimensions.

Beyond the table above, two points deserve emphasis:

  • Normal links can’t be attributed: Telegram itself doesn’t provide data on which link a user clicked from. You can’t know which ads brought Bot sessions.
  • Diversion links support pre-routing: Before the user enters the Bot, the system has already decided the subsequent assignment logic (e.g., all agents / specific agent) based on rules, which is more flexible than pure Bot-internal code.

The following steps assume you’ve already added a Bot project in the TG-Staff console and ensured it’s online.

Step 1: Enter Project Settings

Log in to the TG-Staff console, select the target Bot project, and click “Diversion Links” in the left menu.

Note

Before generating a diversion link, ensure that the corresponding Bot has been configured in TG-Staff and is online. If the Bot is offline, users will not receive an automatic reply after clicking the diversion link.

Step 2: Generate a New Link

Click the “Generate Link” button, and the system will automatically create a unique short link (e.g., https://app.tg-staff.com/aBcDeF). You can:

  • Copy the link directly for use
  • Append tracking parameters to the link (e.g., ?utm_source=twitter&utm_campaign=post1)
  • Set a link expiration date (optional, suitable for limited-time campaigns)

Step 3: Copy and Embed in Channels

Paste the generated link into your ad system, social media posts, email signatures, or website buttons. It is recommended to add UTM parameters to each link for later attribution.

Step 4: Verify

Click the link yourself to confirm it redirects correctly to the Bot, and check the TG-Staff backend to see if IP, UA, and parameter data appear in the session details.

Session Routing Rules: How to Ensure Inquiries Are Properly Assigned?

After the routing link is triggered, the user enters the Bot, but who will handle them? This depends on TG-Staff’s project-level routing rules.

Round Robin vs. Online Priority: Scenario Selection

TG-Staff offers two core routing modes:

  • Round Robin (Default): Polls authorized agents in order, each taking one session. Ideal for load balancing scenarios (e.g., customer service team at fixed stations with stable headcount).
  • Online Priority: Assigns sessions to currently online agents first; falls back to round robin when all are offline. Ideal for quick response scenarios (e.g., flexible team, remote work, uneven busyness).

Selection Recommendations:

  • Fixed agent headcount with clear schedules → Round Robin
  • Flexible team, remote work, uneven workload → Online Priority

Configure Project Customer Service Scope

In project settings, you can specify the customer service scope for routing links:

  • All Agents: All agents with project permissions may receive sessions
  • Specific Agents: Only specific agent groups (e.g., “Pre-sales Team” or “Chinese Support Team”) receive sessions from this link

This is very useful for multi-team, multi-project scenarios. For example, if one Bot serves both pre-sales and after-sales, you can generate two routing links, each bound to different agent groups, achieving automatic routing.

Suppose you are running Google Ads, Facebook Ads, and Twitter posts simultaneously, and you want to know how many Bot sessions and conversions each channel brings.

Steps:

  1. Generate a separate routing link for each channel (or use the same link with different UTM parameters)

    • Google Ads: https://app.tg-staff.com/code?utm_source=google&utm_campaign=product_launch
    • Facebook: https://app.tg-staff.com/code?utm_source=facebook&utm_campaign=product_launch
    • Twitter: https://app.tg-staff.com/code?utm_source=twitter&utm_campaign=post1
  2. Place the links in each channel’s ads or posts

  3. View attribution data in TG-Staff backend

    • Go to the “Sessions” or “User Profile” module
    • Filter and sort by UTM parameters
    • View session count, user IP distribution, and conversion status per source (requires Bot behavior tracking)

Best Practices

It is recommended to append utm_source and utm_campaign parameters to each ad link. Combined with split-link tracking, you can clearly monitor bot conversion performance per channel. Avoid using links with empty parameters, otherwise all sources will be mixed together.

Advanced Usage:

  • Combine with Traffic Distribution feature: When traffic surges on a channel, automatically redirect some users to designated agent groups to prevent single agent overload.
  • Leverage User Profiles: Write captured IP and parameters into user tags, enabling differentiated operations based on source (e.g., push discount codes to users from Google).

While distribution links are powerful, they are not foolproof. Below are common issues and solutions:

IssuePossible CauseSolution
Link fails to redirectBot project deleted or offlineCheck Bot status, regenerate link
Parameters not capturedIncorrect parameter format (e.g., missing ?) or special characters usedEnsure parameter format is ?key=value&key2=value2
Session not assigned to agentAll agents offline, and distribution rule set to “Online First”Configure offline fallback to “Round Robin”, or ensure at least one agent is online
User reports blank page after redirectLink blocked by third-party platform (e.g., WeChat in-app browser)Use a URL shortener before embedding, or guide users to copy and open in browser
Attribution data inaccurateUser has VPN or privacy mode enabledIP data is for reference only; combine with UTM parameters for primary attribution

General Troubleshooting Steps:

  1. Click the link in an incognito browser to confirm redirection works
  2. Check the session “Details” in TG-Staff admin panel for IP and UA records
  3. Verify distribution rule configuration, ensuring agents are online and have permissions
  4. Contact TG-Staff Support Bot for technical assistance

Frequently Asked Questions

Q: Do distribution link short URLs have an expiration date?

A: No fixed expiration date. They remain valid as long as the associated Bot project is not deleted. Periodically check link validity, especially after changing plans or Bot configurations.

Q: Can a single distribution link be used across multiple channels?

A: Yes. The same link can be used for ads, social media, email, etc., differentiating sources via URL parameters (e.g., utm_source). TG-Staff admin displays attribution data by parameter dimension for channel comparison.

Q: Will a user always be assigned to an agent after clicking a distribution link?

A: Not necessarily. If all agents are offline and the rule is “Online First”, the user will receive an auto-reply from the Bot; the session will be assigned once an agent comes online. Configure “Round Robin” as an offline fallback to ensure users are not forgotten.

Q: Is IP data captured by distribution links compliant?

A: TG-Staff captures IP only for attribution statistics and does not store long-term records. Operators should comply with local privacy regulations (e.g., GDPR) and disclose data usage in their privacy policy. For sensitive industries (e.g., finance, healthcare), consider disabling IP capture or using anonymized data.

Q: Can I use distribution links in the free trial?

A: Distribution links are a Standard plan and above feature. The free trial (3 days) includes all features; after the trial, a Standard or Pro subscription is required. See TG-Staff pricing page for details.


Want to try TG distribution links now? Sign up for TG-Staff Free Trial to experience all features for 3 days, including link generation, session distribution, and attribution data. See Official Documentation for detailed setup. Questions? Contact @tgstaff_robot.