CustomGPT.ai Blog

How can I track link clicks inside my website chatbot?

Short Answer:
You can track link clicks by; enabling built-in analytics or enhanced measurement, using a tag manager (e.g., Google Tag Manager) or custom JavaScript to fire “click” events, and if using CustomGPT.ai, simply activate its link-tagging and event-export features to capture click data automatically.

Track link clicks using built-in analytics

What link-click events are recorded automatically

Many modern analytics solutions, especially Google Analytics 4 (GA4), include “enhanced measurement” that can automatically capture outbound link clicks (i.e., links leaving your domain) without custom code. (Google Help)

How to enable and view link-click reports

In GA4: Admin → Data Streams → select stream → ensure “Outbound link clicks” (or link click tracking) is toggled on. Then navigate to Reports → Engagement → Events and look for the “click” event or any custom event you configured. 

Tip: For internal links (within the same domain) you’ll likely need a custom trigger (see next section) as built-in tracking often focuses on outbound links only. 

Track link clicks with Google Tag Manager

Creating a click-event trigger for your chatbot widget or embedded link

  • In GTM create a new Trigger → type “Just Links” (or “All Elements” if not tag).
  • Choose conditions like Click URL contains your chatbot domain or widget identifier (so you isolate only chatbot-link clicks). 

Sending click data to GA4 or another destination

  • Create a GA4 Event Tag: event_name = e.g. chatbot_link_click.
  • Add parameters: link_url, link_text, click_origin = chatbot.
  • Assign the trigger created in the previous step.
  • Publish container and test via GTM Preview + GA4 DebugView. 

Note: If the chatbot runs inside an iframe, ensure cross-domain events and/or parent-window message passing so clicks inside the iframe are captured.

Track link clicks with custom JavaScript

Adding event listeners to chatbot link elements

If you embed your chatbot widget manually or generate links dynamically, you can add JavaScript in your page that listens for click events on links inside the chatbot container:

document.querySelector('#chatbot-container').addEventListener('click', function(e){
  const link = e.target.closest('a');
  if(link) {
    sendAnalyticsEvent('chatbot_link_click', {
      link_url: link.href,
      link_text: link.innerText
    });
  }
});

Sending events to your analytics platform

Inside the listener you can invoke GA4’s gtag(‘event’, …), or push to your dataLayer for GTM, or send via your own endpoint. Then validate that events arrive properly in your analytics dashboard (look for debug mode or Realtime) and set up as conversion if needed.

Track link clicks through redirect URLs

Using redirect links for attribution

Another way is crafting the links generated by the chatbot to first hit a redirect/tracking endpoint on your domain, then forward to the external page. That way you log the click server-side, and then reroute.

Measuring click-throughs with UTM parameters

Append UTM parameters (e.g., ?utm_source=chatbot&utm_medium=widget&utm_campaign=chat_flow1) to links inside the chatbot so that when users click and land on your site or partner site you know which flow generated the click. Then use analytics reports (Acquisition → Campaigns) to see performance. 

How to do it with CustomGPT.ai

Enable automatic UTM tagging for in-chat links

In the CustomGPT.ai dashboard: Navigate to Analyze → Reporting → toggle Add UTM Tags to In-Chat Links. Once enabled, links your agent emits will automatically get utm_content=customgpt.ai appended. 

Collect and export click/lead events via analytics & API

Inside your workspace you can:

  • Open Analytics → Links & Sources to see “Links clicked in conversations” with counts of link displays vs clicks. 
  • Enable Lead Capture with UTM tag collection; UTM/referrer tags will be stored with the lead record. (CustomGPT)
  • Export lead/click data via CSV, Zapier, or API for deeper analytics or CRM ingestion. (CustomGPT)

Steps summary:

  1. Deploy your agent on your site (embed script or widget).
  2. Turn on Add UTM Tags to In-Chat Links.
  3. (Optional) Enable Lead Capture and UTM tag collection.
  4. Monitor Analytics → Links & Sources or export data.
  5. Map the captured click data or leads into your analytics/CRM for further insights.

This gives a largely no-code / low-code way to start tracking link clicks inside your chatbot with minimal setup.

Example — Tracking chatbot link clicks with GTM and CustomGPT.ai

Imagine you run a website with an embedded chatbot that offers product recommendations. You want to know how many users click the “Learn More” links inside the chat. Here’s how you might set that up:

  • Activate the platform’s Add UTM Tags to In-Chat Links option. Now links output by the bot have ?utm_content=customgpt.ai.
  • In GA4, check Acquisition → Campaigns and filter utm_content equals customgpt.ai to see sessions starting from chat-links.
  • In GTM, create a trigger: “Just Links” where Click URL contains yourproductpage.com and Click URL parameter utm_content equals customgpt.ai.
  • Create a GA4 event tag: name chatbot_learn_more_click, parameters include link_url and page_location. Assign it to that trigger.
  • Publish the GTM container; in preview mode click the bot’s “Learn More” link inside the chat and verify the event in GA4 DebugView.
  • In your analytics dashboard under Links & Sources, check that the link was displayed X times and clicked Y times; calculate CTR inside the chatbot.
  • Use CRM or lead-data export from the system to see which users clicked the link and whether they converted later.
  • Over time, compare different messages in the chatbot (maybe change wording, placement) and use the click-data to optimize for higher link-click rate.

Conclusion

Tracking link clicks is ultimately a choice between instrumenting events yourself or using a system that captures them automatically without extra code.

CustomGPT.ai handles this for you with built-in UTM tagging, link-level analytics, and exportable click events that plug straight into your reporting or CRM. Open your agent’s Analytics panel, enable link tagging, and watch click data flow in instantly. Ready to measure what your chatbot actually drives? Turn it on in your CustomGPT.ai workspace.

 

3x productivity.
Cut costs in half.

Launch a custom AI agent in minutes.

Instantly access all your data.
Automate customer service.
Streamline employee training.
Accelerate research.
Gain customer insights.

Try 100% free. Cancel anytime.