This sends each link click to GA4 with three parameters: the page it happened on, the link text, and the link URL.
Variables
Under Variables, Configure built-in variables, enable Click Text, Click URL, Page Path, and Page Hostname. Click Text often returns nothing for image links; also enable Click Classes or Click ID if needed.
Triggers
Create two Just Links triggers (select Some Link Clicks, and leave Wait for Tags on):
| Trigger | Fires when |
|---|
| Click - Internal | Click URL contains kp-analytics.com (use your own domain) |
| Click - External | Click URL does not contain your domain |
GA4 event tags
Create two Google Analytics: GA4 Event tags using your Measurement ID variable:
| Tag | Event name | Trigger |
|---|
| GA4 - Click Internal | click_internal | Click - Internal |
| GA4 - Click External | click_external | Click - External |
Add these event parameters to both tags:
| Parameter name | Value |
|---|
| click_text | {{Click Text}} |
| click_url | {{Click URL}} |
| click_page_path | {{Page Path}} |
Avoid double counting: GA4 Enhanced Measurement already records outbound clicks as a click event. If you track external links here, turn off Outbound clicks under Data streams, Enhanced measurement, gear icon. Also, GA4 already attaches page_location to every event, so click_page_path is a cleaner path-only value for reporting.
Privacy: mailto: links and URLs with query strings can contain personal data. Exclude those links from the triggers, or strip the query string with a custom JavaScript variable before sending.