I am facing an issue where the Google Ad Manager script provided to me works perfectly in my local development environment, but it does not run after deployment to my server. The browser console shows no errors or warnings in either case, but the ads are not loading on the deployed version.
What I’ve tried:
- Verified that the same script works on local but not on production.
- Checked the browser console for any errors or warnings—none are shown.
- Verified that no ad blockers are interfering.
- Ensured that the deployed environment matches the local environment in terms of configuration.
- Tried inspecting network requests related to ads, but nothing unusual was found.
Environment Details:
- Local: [e.g., Windows/Mac, Browser (Chrome/Firefox/etc.)]
- Server: [e.g., Ubuntu/Debian, Apache/Nginx]
Additional Info:
- I have Build it using Docker and Tested it is working fine locally but not after deployment
- The script is included using standard HTML
<script>
tags. - No CORS-related issues are appearing in the console.
- The website on the server is served over HTTPS, and SSL certificates are correctly installed.
Any insights or ideas on why the script isn’t running in production but works locally would be greatly appreciated!
Here is the Link
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!--
https://support.google.com/admanager/answer/1697712?hl=en&ref_topic=4390040&sjid=4107885407167616336-EU
-->
<script src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
<script>
window.googletag = window.googletag || { cmd: [] };
googletag.cmd.push(function () {
googletag.defineSlot('/28379801/Starbazaar728x90', [728, 90], 'div-gpt-ad-1725272785987-0')
.addService(googletag.pubads());
googletag.enableServices();
});
</script>
</head>
<body>
<h1>Hello World</h1>
<div id='div-gpt-ad-1725272785987-0' style='min-width: 728px; min-height: 90px;'>
<script>
googletag.cmd.push(function () { googletag.display('div-gpt-ad-1725272785987-0'); });
</script>
</div>
</body>
</html>