Skip to content

feat: multi-banner rotation with targeting and PostHog tracking#227

Merged
LZylstra merged 4 commits intomainfrom
bry/banner-update
Mar 24, 2026
Merged

feat: multi-banner rotation with targeting and PostHog tracking#227
LZylstra merged 4 commits intomainfrom
bry/banner-update

Conversation

@bryantgillespie
Copy link
Copy Markdown
Member

Summary

Adds support for multiple site banners in rotation with page targeting, scheduling, session-sticky random selection, and PostHog analytics tracking. All configuration lives in the Directus CMS.

What Changed

  • app/components/Nav/Banner.vue — Rewritten to fetch all published banners, filter by page targeting and schedule, select via session-sticky random (with targeted banner priority), track impressions/clicks via PostHog, and fade-transition content on banner changes.
  • types/schema/content/site-banner.ts — Added include_paths, exclude_paths, date_start, date_end fields to the SiteBanner interface.
  • Directus CMS — Four new fields added to site_banners collection: include_paths (tags), exclude_paths (tags), date_start (datetime), date_end (datetime).

How to Test

  1. Open the deploy preview
  2. Create 2+ published banners in Directus with different include_paths (e.g., one for /pricing/*, one with no targeting)
  3. Navigate between pages — verify targeted banners show on matching pages, generic banners elsewhere
  4. Verify banner persists within a session (same tab, navigation between non-targeted pages)
  5. Dismiss a banner — verify it stays dismissed across pages
  6. Check browser PostHog debugger for banner_impression and banner_click events

Deploy Preview

- Fetch all published banners instead of just the latest
- Session-sticky random selection with targeted banner priority
- Page targeting via include/exclude URL wildcards from Directus CMS
- Schedule support via date_start/date_end fields
- PostHog banner_impression and banner_click event tracking
- Fade transition when banner content changes between pages

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 6, 2026

Deploy Preview for directus-website ready!

Name Link
🔨 Latest commit 65cc063
🔍 Latest deploy log https://app.netlify.com/projects/directus-website/deploys/69c2ce6404d60e0008142cf9
😎 Deploy Preview https://deploy-preview-227--directus-website.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@LZylstra LZylstra merged commit b279fe1 into main Mar 24, 2026
6 of 7 checks passed
@LZylstra LZylstra deleted the bry/banner-update branch March 24, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants