PreferredSource
Get added as a preferred source on Google
Generate a polite, dismissible bar that invites your visitors to pin your site in Google. Customize, copy the snippet, paste anywhere.
Customize your bar
Adjust the inputs — preview and snippet update live.
Display rules
In GTM: New Tag → Custom HTML → paste below → Trigger: All Pages.
<!-- My brand: Add as a preferred source on Google (GTM Custom HTML tag) -->
<style>
html.bc-has-top-bar{scroll-padding-top:56px;}
body.bc-has-top-bar{padding-top:56px !important;}
#bc-preferred-source-bar{position:fixed;top:0;left:0;right:0;height:56px;z-index:2147483000;display:flex;align-items:center;justify-content:center;padding:8px 48px 8px 16px;background:#0a0a0a;box-shadow:0 1px 0 rgba(255,255,255,.06);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;}
#bc-preferred-source-bar a.bc-cta{display:inline-flex;align-items:center;gap:10px;color:#ffffff;text-decoration:none;font-size:13px;font-weight:500;line-height:1.15;padding:6px 10px;border-radius:9999px;transition:opacity .15s ease;}
#bc-preferred-source-bar a.bc-cta:hover{opacity:.85;}
#bc-preferred-source-bar .bc-g{display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;background:#fff;border-radius:9999px;}
#bc-preferred-source-bar .bc-close{position:absolute;right:12px;top:50%;transform:translateY(-50%);display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:9999px;background:transparent;border:0;color:#ffffff;opacity:.7;cursor:pointer;padding:0;}
#bc-preferred-source-bar .bc-close:hover{opacity:1;background:rgba(255,255,255,.08);}
</style>
<script>
(function(){
var DISMISS_KEY = 'bc_preferred_source_dismissed';
var CLICK_KEY = 'bc_preferred_source_clicked';
var DISMISS_MODE = "days"; // 'session' | 'days' | 'never'
var DISMISS_DAYS = 180;
var HIDE_AFTER_CLICK = true;
function readFlag(key){
if (document.cookie.indexOf(key + '=1') !== -1) return true;
try { if (localStorage.getItem(key) === '1') return true; } catch(e){}
return false;
}
function readSession(key){
try { return sessionStorage.getItem(key) === '1'; } catch(e){ return false; }
}
function writePersistent(key, days){
try {
var d = new Date(); d.setTime(d.getTime() + days*24*60*60*1000);
document.cookie = key + '=1; expires=' + d.toUTCString() + '; path=/; SameSite=Lax';
} catch(e){}
try { localStorage.setItem(key, '1'); } catch(e){}
}
function writeSession(key){
try { sessionStorage.setItem(key, '1'); } catch(e){}
}
function shouldHide(){
if (HIDE_AFTER_CLICK && readFlag(CLICK_KEY)) return true;
if (DISMISS_MODE === 'never') return false;
if (DISMISS_MODE === 'session') return readSession(DISMISS_KEY);
return readFlag(DISMISS_KEY);
}
function recordClick(){
if (HIDE_AFTER_CLICK) writePersistent(CLICK_KEY, 3650);
}
function recordDismiss(){
if (DISMISS_MODE === 'never') return;
if (DISMISS_MODE === 'session') writeSession(DISMISS_KEY);
else writePersistent(DISMISS_KEY, DISMISS_DAYS || 1);
}
var BAR_H = 56;
var shifted = [];
var dismissed = false;
var mo = null;
var iv = null;
function offsetFixedHeaders(){
if (dismissed) return;
var nodes = document.querySelectorAll('header, nav, [class*="header" i], [class*="navbar" i], [data-sticky], [class*="sticky" i], [class*="fixed" i]');
for (var i=0;i<nodes.length;i++){
var el = nodes[i];
if (el.id === 'bc-preferred-source-bar' || el.closest('#bc-preferred-source-bar')) continue;
if (el.getAttribute('data-bc-shifted') === '1') continue;
var cs = window.getComputedStyle(el);
if ((cs.position === 'fixed' || cs.position === 'sticky')) {
var edgeVal = parseFloat(cs.top);
if (!isNaN(edgeVal) && edgeVal <= 0) {
el.setAttribute('data-bc-prev-edge', el.style.top || '');
el.style.top = (edgeVal + BAR_H) + 'px';
el.setAttribute('data-bc-shifted', '1');
shifted.push(el);
}
}
}
}
function restoreFixedHeaders(){
for (var i=0;i<shifted.length;i++){
var el = shifted[i];
el.style.top = el.getAttribute('data-bc-prev-edge') || '';
el.removeAttribute('data-bc-prev-edge');
el.removeAttribute('data-bc-shifted');
}
shifted = [];
}
function teardown(){
dismissed = true;
if (iv) { clearInterval(iv); iv = null; }
if (mo) { try { mo.disconnect(); } catch(e){} mo = null; }
window.removeEventListener('scroll', offsetFixedHeaders);
window.removeEventListener('resize', offsetFixedHeaders);
var el = document.getElementById('bc-preferred-source-bar');
if (el && el.parentNode) el.parentNode.removeChild(el);
document.documentElement.classList.remove('bc-has-top-bar');
document.body && document.body.classList.remove('bc-has-top-bar');
restoreFixedHeaders();
}
function dismiss(){
recordDismiss();
teardown();
}
if (shouldHide()) return;
if (document.getElementById('bc-preferred-source-bar')) return;
document.documentElement.classList.add('bc-has-top-bar');
var apply = function(){ document.body && document.body.classList.add('bc-has-top-bar'); };
apply();
if (!document.body) document.addEventListener('DOMContentLoaded', apply);
var wrap = document.createElement('div');
wrap.id = 'bc-preferred-source-bar';
wrap.innerHTML = '<a class="bc-cta" href="https://www.google.com/preferences/source?q=Mysite.com" target="_blank" rel="noopener noreferrer" aria-label="Add My brand as a preferred source on Google">'
+ '<span class="bc-g"><svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true">'
+ '<path fill="#4285F4" d="M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.44c-.28 1.4-1.07 2.59-2.29 3.4v2.83h3.69c2.16-1.99 3.4-4.93 3.4-8.47z"/>'
+ '<path fill="#34A853" d="M12 24c3.24 0 5.95-1.08 7.93-2.92l-3.69-2.83c-1.02.69-2.33 1.1-4.24 1.1-3.26 0-6.02-2.2-7.01-5.16H1.18v2.92C3.15 21.31 7.27 24 12 24z"/>'
+ '<path fill="#FBBC05" d="M4.99 14.19A7.2 7.2 0 0 1 4.6 12c0-.76.14-1.5.39-2.19V6.89H1.18A12 12 0 0 0 0 12c0 1.94.46 3.77 1.18 5.39l3.81-3.2z"/>'
+ '<path fill="#EA4335" d="M12 4.75c1.77 0 3.35.61 4.6 1.8l3.27-3.27C17.95 1.19 15.24 0 12 0 7.27 0 3.15 2.69 1.18 6.61l3.81 2.92C5.98 6.95 8.74 4.75 12 4.75z"/>'
+ '</svg></span><span>Add Mysite.com as a preferred source on Google</span></a>'
+ '<button type="button" class="bc-close" aria-label="Dismiss">'
+ '<svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>'
+ '</button>';
(document.body || document.documentElement).appendChild(wrap);
wrap.querySelector('.bc-cta').addEventListener('click', recordClick);
var cl = wrap.querySelector('.bc-close'); if (cl) cl.addEventListener('click', dismiss);
function start(){
offsetFixedHeaders();
var ticks = 0;
iv = setInterval(function(){ offsetFixedHeaders(); if (++ticks > 40) { clearInterval(iv); iv = null; } }, 250);
window.addEventListener('scroll', offsetFixedHeaders, { passive: true });
window.addEventListener('resize', offsetFixedHeaders);
try {
mo = new MutationObserver(function(){ offsetFixedHeaders(); });
mo.observe(document.documentElement, { childList:true, subtree:true, attributes:true, attributeFilter:['class','style'] });
} catch(e){}
}
if (document.body) start(); else document.addEventListener('DOMContentLoaded', start);
})();
</script>Why it matters
Turn casual visitors into preferred sources
Google’s "Add as a preferred source" feature lets readers personally select which publishers they want to see more of. A small nudge at the right moment — delivered through a clean, dismissible bar — can permanently increase your reach.
Higher visibility
When readers add you as a preferred source, your articles surface more often in their Google Search results and Google News feed — directly in front of the people already interested in your niche.
Loyal audience growth
Preferred sources create a direct channel between your publication and your readers. Instead of fighting for attention on social feeds, you own the relationship.
Better click-through rates
Google labels preferred-source content with your brand name and favicon, making your links instantly recognizable and more likely to earn the click.
Algorithm resilience
A base of readers who actively chose you reduces your dependency on ranking fluctuations. Preferred-source traffic is more stable and engaged over time.
How the preferred-source bar works
- 1A visitor lands on your article or homepage.
- 2Your PreferredSource bar appears with a friendly invitation to add your site as a preferred source on Google.
- 3If they dismiss it, the bar respects their choice and only reappears based on the rules you set.
- 4If they click through, Google handles the subscription — no extra account or form required.
Feedback? Need a different design, a popup, a button, or something else? Tell me about it