From 89fbd222f25b5e6417bf3c94ac705b9308bf1d6d Mon Sep 17 00:00:00 2001 From: svemagie <869694+svemagie@users.noreply.github.com> Date: Wed, 25 Mar 2026 09:04:34 +0100 Subject: [PATCH] feat: add Umami reader-source tracking tags Classify visitors by referrer into segments (direct, search, fediverse, bluesky, indieweb, web) via a custom umami.track('reader-source') event. Add noscript pixels to RSS/JSON feeds so feed-reader activity appears under virtual /rss/* paths in Umami. Co-Authored-By: Claude Sonnet 4.6 --- _includes/layouts/base.njk | 29 +++++++++++++++++++++++++++++ feed-json.njk | 3 ++- feed.njk | 3 ++- 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/_includes/layouts/base.njk b/_includes/layouts/base.njk index 36c38c1..ba4491a 100644 --- a/_includes/layouts/base.njk +++ b/_includes/layouts/base.njk @@ -2,6 +2,35 @@ + {# OG image resolution handled by og-fix transform in eleventy.config.js to bypass Eleventy 3.x parallel rendering race condition (#3183). Template outputs __OG_IMAGE_PLACEHOLDER__ and __TWITTER_CARD_PLACEHOLDER__ diff --git a/feed-json.njk b/feed-json.njk index 77d2291..9ebdaad 100644 --- a/feed-json.njk +++ b/feed-json.njk @@ -50,7 +50,8 @@ eleventyImport: "id": "{{ absolutePostUrl }}", "url": "{{ absolutePostUrl }}", "title": {% if post.data.title %}{{ post.data.title | jsonEncode | safe }}{% else %}null{% endif %}, - "content_html": {{ post.content | htmlToAbsoluteUrls(absolutePostUrl) | jsonEncode | safe }}, + {%- set _jsonPixel = '' %} + "content_html": {{ (post.content | htmlToAbsoluteUrls(absolutePostUrl) + _jsonPixel) | jsonEncode | safe }}, "content_text": {{ post.content | striptags | jsonEncode | safe }}, "date_published": "{{ post.date | dateToRfc3339 }}", "date_modified": "{{ (post.data.updated or post.date) | dateToRfc3339 }}" diff --git a/feed.njk b/feed.njk index ef53fd0..06db16d 100644 --- a/feed.njk +++ b/feed.njk @@ -35,7 +35,8 @@ eleventyImport: {{ absolutePostUrl }} {{ absolutePostUrl }} {{ post.date | dateToRfc822 }} - {{ post.content | htmlToAbsoluteUrls(absolutePostUrl) | escape }} + {%- set _rssPixel = '' %} + {{ (post.content | htmlToAbsoluteUrls(absolutePostUrl) + _rssPixel) | escape }} {%- if postImage and postImage != "" and (postImage | length) > 10 %} {%- set imageUrl = postImage | url | absoluteUrl(site.url) %}