Quick Answer
To track internal link clicks in Google Analytics:
- Use Google Tag Manager to create a trigger for internal links
- Set up a GA4 or Universal Analytics event tag
- Apply the trigger to your analytics tag
- Test and publish your configuration
Alternatively, you can use manual code implementation or a dedicated link tracking tool like Beckli.
Why Track Internal Link Clicks?
Tracking internal link clicks in Google Analytics can transform your understanding of your website. By monitoring how visitors navigate from page to page, you can optimize your site structure, improve content connections, and create a more effective user journey.
Internal links are any links on your website that point to other pages on the same domain. Monitoring these clicks helps you:
-
Understand User Behavior: Identify which internal links users find most interesting and which pathways they prefer when navigating your site.
-
Improve Navigation & Content: Discover which internal links are rarely clicked, allowing you to adjust placement, design, or anchor text to improve engagement.
-
Measure Content Relationships: Track how effectively users flow between related content pieces, helping you strengthen topical clusters.
-
Optimize Calls-to-Action: Test different internal link placements and text to see which drive the most engagement.
-
Refine SEO Strategy: Improve your internal linking structure based on actual user behavior rather than assumptions.
In this guide, I'll show you how to set up internal link click tracking, explain different implementation methods, and help you analyze the resulting data.
Setting Up Internal Link Click Tracking in Google Analytics
The most effective way to track internal link clicks is through event tracking in Google Analytics. There are two main methods: using Google Tag Manager or implementing direct code.
Method 1: Using Google Tag Manager (Recommended)
Google Tag Manager (GTM) is the preferred approach because it's more flexible and doesn't require modifying your website code each time you want to adjust your tracking.
Step 1: Ensure GTM and Analytics Are Properly Installed
Before proceeding, verify that:
- You have a Google Analytics property (either GA4 or Universal Analytics)
- Google Tag Manager is installed on your site
- Your GTM container is connected to your Analytics property
If you need to set these up:
Step 2: Enable Click Variables in GTM
First, you need to ensure GTM can capture information about clicked links:
- Log in to your GTM account and open your website's workspace
- Click on Variables in the left sidebar
- Under Built-In Variables, click Configure
- In the Click section, enable the following variables:
- Click Element
- Click Classes
- Click ID
- Click URL
- Click Text
- Click Target
- Click Save
These variables will capture important data about each link click.
Step 3: Create a Trigger for Internal Link Clicks
Now, create a trigger that will fire only when internal links are clicked:
-
In GTM, go to Triggers and click New
-
Name your trigger (e.g., "Internal Link Clicks")
-
Click in the trigger configuration area
-
Choose Just Links as the trigger type
-
Select Some Link Clicks (not "All Link Clicks")
-
Set the following condition:
- Choose Click URL as the variable
- Select contains as the operator
- Enter your domain name (e.g.,
yourdomain.com
) as the value
This ensures the trigger only fires for links within your domain.
-
Optional: Check Wait for Tags if you want to ensure the tracking completes before the page changes
-
Optional: Check Check Validation to only fire on actual link clicks
-
Click Save
Your trigger is now configured to detect clicks on any internal link within your website.
Step 4: Create a Google Analytics Event Tag
Now you'll create a tag that sends the click data to Google Analytics:
For GA4:
- Go to Tags in GTM and click New
- Name your tag (e.g., "GA4 - Internal Link Click Tracking")
- Click to choose a tag type
- Select Google Analytics: GA4 Event
- Select your GA4 Configuration tag from the dropdown (or create one if needed)
- For Event Parameters:
- Event Name:
internal_link_click
- Parameters:
- Parameter Name:
link_url
/ Value:{{Click URL}}
- Parameter Name:
link_text
/ Value:{{Click Text}}
- Parameter Name:
link_id
/ Value:{{Click ID}}
- Parameter Name:
page_location
/ Value:{{Page URL}}
- Parameter Name:
- Event Name:
- Under Triggering, select the internal link click trigger you created
- Click Save
For Universal Analytics:
- Go to Tags in GTM and click New
- Name your tag (e.g., "UA - Internal Link Click Tracking")
- Click to choose a tag type
- Select Google Analytics: Universal Analytics
- Choose Event as the track type
- Configure as follows:
- Category:
Internal Link
- Action:
Click
- Label:
{{Click URL}}
(or{{Click Text}}
if you prefer) - Non-Interaction Hit:
False
- Category:
- Under Google Analytics Settings, select your GA settings variable
- Under Triggering, select the internal link click trigger you created
- Click Save
Step 5: Preview, Test, and Publish
It's essential to test your setup before publishing:
- Click the Preview button in GTM
- Enter your website URL and click Start
- When your site loads, click various internal links
- In the GTM debugging console, verify that:
- Your trigger fires correctly
- The tag executes properly
- The correct variables are captured
- Check your GA real-time reports to confirm events are being received
- If everything works as expected, return to GTM and click Submit to publish
Your internal link click tracking is now live!
Method 2: Direct Code Implementation
If you don't use Google Tag Manager, you can add tracking code directly to your website.
Universal Analytics Implementation
Add this code to your site's header or footer (after your GA tracking code):
<script>
document.addEventListener('DOMContentLoaded', function() {
// Get all links on the page
var links = document.getElementsByTagName('a');
// Loop through each link
for (var i = 0; i < links.length; i++) {
// Only add tracking to internal links
if (links[i].hostname === window.location.hostname) {
links[i].addEventListener('click', function(e) {
// Send the event to Google Analytics
ga('send', 'event', 'Internal Link', 'Click', this.href);
});
}
}
});
</script>
GA4 Implementation
For GA4, use this code instead:
<script>
document.addEventListener('DOMContentLoaded', function() {
// Get all links on the page
var links = document.getElementsByTagName('a');
// Loop through each link
for (var i = 0; i < links.length; i++) {
// Only add tracking to internal links
if (links[i].hostname === window.location.hostname) {
links[i].addEventListener('click', function(e) {
// Send the event to GA4
gtag('event', 'internal_link_click', {
'link_url': this.href,
'link_text': this.innerText
});
});
}
}
});
</script>
Method 3: Using onclick Attributes (Simple Approach)
For a simpler implementation, you can add onclick attributes directly to specific links:
For Universal Analytics:
<a href="/pricing" onclick="ga('send', 'event', 'Internal Link', 'Click', '/pricing');">
View Pricing
</a>
For GA4:
<a href="/pricing" onclick="gtag('event', 'internal_link_click', {
'link_url': '/pricing',
'link_text': 'View Pricing'
});">
View Pricing
</a>
This method is less automated but gives you precise control over which links you track.
Analyzing Internal Link Click Data in Google Analytics
Once your tracking is set up, you can analyze the data to gain insights.
In Google Analytics 4:
- Go to Reports → Engagement → Events
- Look for your event name (e.g.,
internal_link_click
) - Click on the event name to see more details
- Create custom explorations:
- Go to Explore and create a new exploration
- Add your internal link click event as a dimension
- Break down by link URL, link text, or other parameters
- Compare against user segments or other metrics
In Universal Analytics:
- Go to Behavior → Events → Top Events
- Find the Category you set (e.g., "Internal Link")
- Click to drill down into Actions and Labels
- Add secondary dimensions like Page, User Type, or Device for deeper insights
- Create custom reports combining this data with other metrics
Advanced Analysis Techniques
To gain even more insights from your internal link click data:
Create Funnel Visualizations
Track the sequence of internal link clicks to understand common user journeys:
- In GA4, use the Funnel exploration to create step-by-step visualizations
- In Universal Analytics, set up Goal Funnels using page destinations
Compare Link Performance
Analyze which internal links perform best:
- Compare click rates for the same link in different locations
- A/B test different anchor text for the same destination
- Evaluate performance across different devices or user segments
Identify Navigation Patterns
Look for patterns in how users navigate your site:
- Which internal links are most commonly used to exit each page?
- Do users follow your intended pathways or create their own?
- Are there pages with high link impressions but low click rates?
A Simpler Alternative: Using Beckli
If setting up Google Analytics tracking seems too complex, consider using Beckli as a simpler alternative:
- Go to Beckli.com
- Paste the destination URL of your internal link
- Get a shortened, trackable link
- Use this link in your content instead of the direct internal link
- Access Beckli's analytics dashboard to view click data
Benefits of using Beckli:
- No technical setup required
- Free with no signup needed
- Simple, clear analytics interface
- Works independently of your analytics platform
The drawback is that users will briefly pass through a redirect, but the tracking benefits may outweigh this minor inconvenience.
Troubleshooting Common Issues
If you encounter problems with your internal link tracking:
Events Not Showing in Reports
- Problem: You've set up tracking but don't see events in Google Analytics
- Solutions:
- Check real-time reports first (data in standard reports can be delayed)
- Verify your GA property ID is correct
- Ensure your trigger conditions are properly configured
- Test with GA's Debug mode enabled
Multiple Events Firing
- Problem: Each click is recorded multiple times
- Solutions:
- Check for duplicate tags in GTM
- Verify you don't have multiple event listeners on the same elements
- Use the
once: true
option in event listeners if using direct code
Link Clicks Not Captured Before Page Changes
- Problem: Some events aren't recorded because the page changes too quickly
- Solutions:
- Enable "Wait for Tags" in your GTM trigger
- Add a small delay before navigation in your direct code implementation
- Consider using beacon API for more reliable tracking
Conclusion
Tracking internal link clicks in Google Analytics provides valuable insights into how users navigate your website. Whether you choose GTM for flexibility or direct code for simplicity, the data you collect will help you optimize your site structure and improve user experience.
For beginners, Google Tag Manager offers the best balance of power and usability. If you prefer an even simpler solution, services like Beckli provide straightforward link tracking without complex configuration.
Start with basic implementation, analyze the data regularly, and refine your internal linking strategy based on actual user behavior rather than assumptions. Over time, this data-driven approach will help you create a more effective, user-friendly website that guides visitors naturally toward your key content and conversion points.