diff --git a/index.html b/index.html index 9cb4c87..5ee4018 100644 --- a/index.html +++ b/index.html @@ -16,9 +16,17 @@ (function(){ try { if (window.polliLib) { - // Use a stable referrer for API tiering; avoid hardcoding endpoints elsewhere - window.polliLib.configure({ referrer: 'unityailab.com' }); - window.polliClient = new window.polliLib.PolliClientWeb({ referrer: 'unityailab.com' }); + // Derive base referrer from attribute or window location (no path segments) + const cur = document.currentScript; + const attrRef = cur && cur.getAttribute('data-referrer'); + let base = window.location.origin; + if (attrRef) { + // Support values missing protocol by resolving against window.location.origin + try { base = new URL(attrRef, window.location.origin).origin; } catch {} + } + const referrer = base.endsWith('/') ? base : base + '/'; + window.polliLib.configure({ referrer }); + window.polliClient = window.polliLib.getDefaultClient(); // Provide basic helpers used by image features if (!window.randomSeed) {