Link tracking and UTM tags

PostHog counts opens with a tiny image in each email, and counts clicks by sending links through a redirect. You choose which emails it tracks, and you can tag links so web analytics shows which email sent each visitor.

Opens and clicks

Every automation email step and broadcast email has Track opens and link clicks, on by default. Turn it off for an email that shouldn't be tracked. With it off, PostHog adds no image and doesn't rewrite links. It still records deliveries, bounces, and unsubscribes.

Opens and clicks become PostHog events only when engagement events are on.

An automation email step's settings with the Track opens and link clicks, Connect clicks to sessions, and Add UTM tags to links toggles

Some links break when they go through a redirect, such as app deep links and universal links. Add data-ph-no-track to the link's <a> tag, in a Custom HTML block:

HTML
<a href="https://example.com/open-in-app" data-ph-no-track>Open the app</a>

The link keeps its address, and PostHog doesn't count its clicks.

Sensitive emails

Transactional emails with sign-in codes or reset links can be marked as sensitive. PostHog then doesn't rewrite their links, so a token never goes through a redirect. See sensitive data and tracking.

Connect clicks to sessions

Connect clicks to sessions, on by default, links each tracked click to the session it starts on your site, including its session replay. It adds a URL parameter to links on the domain you send from and its subdomains. Your site needs posthog-js.

UTM tags

Turn on Add UTM tags to links, and PostHog adds these to each link in the email:

TagDefault
utm_sourceposthog
utm_mediumemail
utm_campaignThe broadcast or automation name
utm_contentThe email step name

Change any value, or use Liquid in it. Click Save as team default, and new emails start with the same values. You can also set the defaults in Messaging > Settings > UTM tags on email links.

PostHog tags only http and https links. It keeps any utm_ value a link already has, and skips PostHog's own links, such as the unsubscribe link. To leave one link untagged, add data-ph-no-utm to its <a> tag.

Some countries need a person's consent before you track their opens and clicks. Go to Messaging > Settings > Email tracking consent, and pick:

ModeWhat it does
No consent enforcementTrack by each email's setting. The default.
Opt-outTrack everyone except people who said no.
Opt-inTrack only people who said yes.

People choose on the preferences page. Consent applies only to marketing email, and never tracks an email that has tracking off.

Still have questions?

Was this page useful?