Sub-Account Logo
Log In
C
Chris Pope
Copy and paste this code into the custom JS section of the Agency Company Settings. You can add unlimited subaccounts and has the advantage of inheriting the original css so should auto-size nicely as before.
<script>
(function() {
const logoMap = {
'6Hr81iu8QrnB49S5g8A4': 'https://path/to/image/logo.png',
//=== Add additional subaccounts here as above - '<Subaccount ID>' : '<Image URL>' with a comma at the end
//=== This is for the agency logo and any subaccounts with no image defined above - leave 'default' unchanged and just change the image URL to the required agency (and default) logo URL (NO COMMA AT THE END)!
'default': 'https://path/to/image/logo.png'
};
function getCurrentLocationId() {
const match = location.pathname.match(/\/location\/([a-zA-Z0-9_-]+)/i);
return match ? match[1] : null;
}
function applyCorrectLogo() {
const locId = getCurrentLocationId();
if (!locId) return;
const desiredSrc = logoMap[locId] || logoMap.default;
if (!desiredSrc) return;
const img = document.querySelector('img.agency-logo');
if (img && img.src !== desiredSrc) {
img.src = desiredSrc;
}
}
applyCorrectLogo();
const observer = new MutationObserver((mutations) => {
applyCorrectLogo();
});
observer.observe(document.body, {
childList: true,
subtree: true,
attributes: false
});
const originalPushState = history.pushState;
history.pushState = function () {
originalPushState.apply(this, arguments);
applyCorrectLogo();
};
const originalReplaceState = history.replaceState;
history.replaceState = function () {
originalReplaceState.apply(this, arguments);
applyCorrectLogo();
};
window.addEventListener('popstate', applyCorrectLogo);
})();
</script>
M
Marshanski Digital
Hey, yes ! it would be great !
R
Revo Team
Yeah, this will be beneficial some of my clients ask for it.