Skip to content

Pass ?ref= through to Summit 2026 Pretix widget as campaign code - #1260

Merged
rrrutledge merged 2 commits into
masterfrom
summit-2026-referral-campaign
Sep 30, 2026
Merged

rrrutledge merged 2 commits into
masterfrom
summit-2026-referral-campaign

Conversation

@rrrutledge

@rrrutledge rrrutledge commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Members sharing a Summit 2026 referral link (e.g. https://innersourcecommons.org/events/isc-2026/?ref=ISC26-ADADAI) now have that code carried into the embedded Pretix ticket widget, so Pretix can credit the resulting order to the member's campaign.

  • layouts/partials/head.html defines window.pretixWidgetCallback (gated behind .Params.pretixWidget, so only the Summit 2026 page is affected) before the Pretix widget script loads.
  • The callback reads ?ref= from the page URL and, only when it matches ^ISC26-[A-Z0-9-]{1,40}$, sets data-campaign on the <pretix-widget> element.
  • The callback always calls window.PretixWidget.buildWidgets(), with or without a valid ref, so the widget builds exactly as it does today when no ref is present.
  • The page's no-JS fallback link (inside <noscript>) is left untouched: browsers never parse <noscript> content into the DOM when JavaScript is enabled, so a script-driven rewrite of that link can never actually run, and for JS-disabled visitors there's no ?ref= handling happening anyway (the widget itself requires JS).

Test plan

  • Full hugo build completes cleanly.
  • Local dev server, checked with browser-chauffeur:
    • No ?ref= — <pretix-widget> has no data-campaign attribute, page renders unchanged.
    • ?ref=ISC26-TEST — data-campaign="ISC26-TEST" is set, widget still builds.
    • ?ref=<script> (invalid) — rejected by the regex, no attribute set, no JS errors.
  • Re-check on the live site after merge (this repo has no PR deploy-preview environment - it only builds to production via GitHub Actions on push to master).

Screenshots

Full page, ?ref= has no visible effect on rendering (confirmed pixel-identical across all three test cases above):
isc-2026-fullpage

Members share links like ?ref=ISC26-ADADAI so Pretix can credit ticket
orders to their referral campaign. Validates the code against
^ISC26-[A-Z0-9-]{1,40}$ before setting data-campaign; without a ref,
the widget behaves exactly as before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UsSuPgoXdF4gxEGPgcRjpj
@rrrutledge
rrrutledge requested a review from a team as a code owner September 30, 2026 20:16
The "buy tickets on Pretix" fallback link lives inside a <noscript>
block, which browsers never parse into the DOM when JavaScript is
enabled, so the rewrite could never find the element - it's removed
rather than kept as no-op code. The campaign attribution itself
(data-campaign on the widget) is unaffected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UsSuPgoXdF4gxEGPgcRjpj
@rrrutledge
rrrutledge merged commit 198b910 into master Sep 30, 2026
4 checks passed
@rrrutledge
rrrutledge deleted the summit-2026-referral-campaign branch September 30, 2026 22: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.

1 participant