Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Venetian/Palazzo referer detection for 'Back to' link
let referrerUrl = document.referrer;
let referrerUrlMatch = referrerUrl.match(/^https?:\/\/www\.(venetian|palazzo)\.com(?!\/meetings(\/|$))/);
let referrerName = referrerUrlMatch ? referrerUrlMatch[1] : null;

At that point, referrerName is either “venetian", "palazzo", or null (if referrer URL was from neither of the two sites, or if the path started with “/meetings/“), and the referrerUrl can be used as needed.

Examples: "” returns null "“ returns null "” returns null "“ returns null "” returns “venetian” "” returns “palazzo” (And hard-redirects to the anyway) To be tested, of course.

(snippet provided by Silvan)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.