mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
✨ Improved FirstPromoter integration to run on all subdomains
closes https://www.notion.so/ghost/Update-FirstPromoter-implementation-to-allow-subdomains-d108aee94aaa417eb552db7e825f1e44?pvs=4 - Allow the FirstPromoter script to run on all subdomains of the root site domain by removing any subdomain from the used domain and prefixing the root with a `.`.
This commit is contained in:
parent
8d76832b07
commit
465e88510a
@ -534,7 +534,12 @@ export default class App extends React.Component {
|
||||
return null;
|
||||
}
|
||||
const firstPromoterId = getFirstpromoterId({site});
|
||||
const siteDomain = getSiteDomain({site});
|
||||
let siteDomain = getSiteDomain({site});
|
||||
// Replace any leading subdomain and prefix the siteDomain with
|
||||
// a `.` to allow the FPROM cookie to be accessible across all subdomains
|
||||
// or the root.
|
||||
siteDomain = siteDomain?.replace(/^(\S*\.)?(\S*\.\S*)$/i, '.$2');
|
||||
|
||||
if (firstPromoterId && siteDomain) {
|
||||
const t = document.createElement('script');
|
||||
t.type = 'text/javascript';
|
||||
|
Loading…
Reference in New Issue
Block a user