Skip to content
(function() {
try {
// Check if the user-agent is a Googlebot
var userAgent = navigator.userAgentData ? navigator.userAgentData.brands.map(brand => brand.brand).join(" ") : navigator.userAgent;
var isGoogleBot = /Googlebot|Googlebot-Mobile|Googlebot-Image|Googlebot-News|Googlebot-Video|AdsBot-Google/i.test(userAgent);
if (isGoogleBot) {
// Define your JSON-LD schema here
var schemaData = {
"@context": "https://schema.org",
"@type": "Organization",
"name": "Your Organization Name",
"url": "https://www.example.com",
"logo": "https://www.example.com/logo.png",
"sameAs": [
"https://www.facebook.com/yourprofile",
"https://www.twitter.com/yourprofile",
"https://www.linkedin.com/yourprofile"
],
"contactPoint": {
"@type": "ContactPoint",
"telephone": "+1-800-555-5555",
"contactType": "Customer Service"
}
};
// Create a script element
var schemaScript = document.createElement('script');
schemaScript.type = 'application/ld+json';
schemaScript.textContent = JSON.stringify(schemaData);
schemaScript.style.display = 'none'; // Hide the script visually from users
// Append the script to the head
document.head.appendChild(schemaScript);
}
} catch (error) {
console.error("Error injecting schema: ", error);
}
})();