Link Tracking

Link Tracking Tests

Right-click and view source on any link to see what the code looks like.

Anchor

Click to go to the anchor further below.

Telephone

(555) 555-1234

Data vars test: (555) 555-1234 (custom event example)

Email

Test email (tracked by default)

Data vars test: Test email (custom event)

Custom Attributes

Go to Homepage (simple custom event example)

Go to Homepage (internal-link custom event)

Shop (cta custom event)

Shop (another internal custom event)

Custom Event with Dynamic Link Label —The original data-vars-ga-label is replaced dynamically via JavaScript.

UTM

This a test of a self-hosted UTM parameter link.

This is where an anchor link will land

This is some anchor text. Click on Link Tracking > Anchor Tracking in the main menu to get here.

Internal Link (not tracked)

Go to Shop page (internal click not tracked by default)


Outbound Links

Plain link

About caught my eye (outbound link tracked by default)

Link with data-vars-ga-label set

This is an outbound link with data-vars-ga-label set.

This is handy if you’re link text isn’t descriptive.

<p>
    This is an 
    <a href="https://www.caughtmye.cc" id="custom-outbound-link" data-vars-ga-label="This is a link that overrides the link text ;-)">
        outbound link
    </a>
    with data-vars-ga-label set.
</p>

This is an image link. The image has alt text set, so the alt text will be used as the event label.

Rocco at Campuhan Ridge
Our beloved Rocco

Custom Social Share Events

Each link below sends a custom event to GA.

Facebook  •  Twitter  •  Instagram

GA realtime results

GA realtime report results for custom social share events.

HTML source code

<a 
  href="https://www.facebook.com"
  onclick="sendSocialClick('Facebook', 'https://streetphotography.blog');" 
  target="_blank">
    Facebook
</a>

JavaScript souce code

See the JavaScript code on GitHub.