Google AdSense for Website - AdSense Auto Ads, Ad Unit Snippet and ads.txt
by Modvanta https://modvantaapps.tech/odoo-apps/website-adsense/$ 9.97

Google AdSense for the Odoo 19 Website
Earn from your Odoo website traffic with Google AdSense: enter your publisher ID, switch on Auto ads or drop ad unit blocks where you want them, and the module serves your ads.txt, keeps ads off your checkout and respects the visitor's cookie choice.
Written and supported by Modvanta - modvantaapps@gmail.com
Odoo 19 Community and EnterpriseAuto adsDrag and drop ad unit blockads.txt served for youCookie bar aware27 automated tests
What it does
In plain language Odoo 19 has no AdSense setting: you would have to paste Google's code into the page head by hand and write ads.txt yourself. This module adds an AdSense section to the website settings: publisher ID, Auto ads, test mode and consent. An "AdSense Ad" block in the website editor places a manual ad unit anywhere: you type the slot ID from AdSense. It serves /ads.txt, adds the AdSense verification tag, and never shows ads on checkout, cart or account pages. | Who it is for Blogs, magazines and content sites built with Odoo Website. Directories, communities and free-tool sites that live on display advertising. Shops that want ads on blog or guide pages but never on the checkout. Agencies setting up AdSense for an Odoo customer in minutes. |
Key features
Every screenshot below was taken on Odoo 19 with this module installed.
FEATURE 1
What it adds over Odoo 19
Odoo 19 has Google Analytics and a cookie bar, but nothing for AdSense. The module adds:
Publisher ID per website and the AdSense site verification meta tag
Auto ads: the AdSense code on every allowed page
An AdSense Ad block for the website editor with slot ID and ad type
An /ads.txt file with your publisher line and extra lines of other networks
No ads on chosen pages or URL paths, and no ads for employees
Consent: wait for the cookie bar, non-personalised ads until consent, or load at once

FEATURE 2
ads.txt served for you
AdSense asks every site for an ads.txt file. The module answers /ads.txt with the Google line built from your publisher ID, plus any lines you add for other ad networks.
Switch it off if you serve your own file
Shown live in the settings so you can check it

FEATURE 3
Drag and drop ad units
Drop the AdSense Ad block on any page (also inside columns), then type the ad slot ID and choose the type: display (responsive, horizontal, rectangle, vertical), in-article, in-feed with its layout key, or multiplex.
A placeholder shows in the editor only
Visitors see the ad; the block disappears where ads are not allowed

FEATURE 4
No ads where they hurt
Tick No Ads in the page properties (or in the pages list) and that page never loads AdSense. URL paths can be excluded too: cart, checkout, payment and My Account are excluded by default.
Logged-in employees see no ads (optional), website editors never do
Language prefixes such as /fr/ are handled

How it works
| 1 | Install Install the module on your Odoo 19 website. |
| 2 | Enter your publisher ID Website -> Configuration -> Settings -> Google AdSense: switch it on and paste ca-pub-... from your AdSense account. |
| 3 | Add the site in AdSense In AdSense add your domain: the verification tag and ads.txt are already there. |
| 4 | Auto ads or ad units Turn on Auto ads in AdSense, or create ad units there and drop AdSense Ad blocks with their slot IDs on your pages. |
Settings
| Google AdSense | On or off per website |
| Publisher ID | ca-pub- followed by 16 digits (pub-... is accepted and completed) |
| Auto Ads | Load the AdSense code on every allowed page, or only on pages with an ad block |
| Site Verification Tag | Adds the google-adsense-account meta tag |
| Test Mode | Adds data-adtest="on" to ad units while you build the pages |
| Consent | Wait for consent / non-personalised ads until consent / load at once |
| No Ads on URLs | One path per line, cart, checkout, payment and account by default |
| No Ads for Employees | Internal users do not see ads |
| ads.txt | Serve /ads.txt, extra lines for other networks |
FAQ
Do I need an AdSense account?
Yes. The module places Google's code on your site; Google decides if and which ads are shown and pays you. Approval of your site is done by Google.
Does it work with the Odoo cookie bar?
Yes. With "Wait for consent" the AdSense code is only loaded after the visitor accepts optional cookies. With "Non-personalised ads" ads load at once but without personalisation until the visitor accepts.
Why do I not see the ads myself?
Website editors never see ads, so editing stays clean and you cannot click your own ads by mistake. Logged-in employees are hidden too unless you switch that off. Open the site in a private window to see what visitors see.
Can I use other ad networks?
You can add their lines to ads.txt here. Their scripts are not handled by this module.
Does it slow the website down?
The AdSense script loads asynchronously. With Auto ads off, it is only loaded on pages that contain an ad block.
Compatibility and support
Odoo 19 Community and Enterprise. Depends only on Website. Ads are served by Google AdSense; an approved AdSense account is needed for real ads.
Questions, a demo or a custom change: modvantaapps@gmail.com
AUTHOR Modvanta | INCLUDED Settings, ad unit block, ads.txt, page and URL exclusions, consent modes |
Buy Now - $10Hire Us for Odoo Work
Written and supported by Modvanta - modvantaapps@gmail.com
| Availability |
Odoo Online
Odoo.sh
On Premise
|
| Odoo Apps Dependencies |
•
Website (website)
• Discuss (mail) |
| Lines of code | 462 |
| Technical Name |
mdv_website_adsense |
| License | OPL-1 |
| Website | https://modvantaapps.tech/odoo-apps/website-adsense/ |
Odoo Proprietary License v1.0 This software and associated files (the "Software") may only be used (executed, modified, executed after modifications) if you have purchased a valid license from the authors, typically via Odoo Apps, or if you have received a written agreement from the authors of the Software (see the COPYRIGHT file). You may develop Odoo modules that use the Software as a library (typically by depending on it, importing it and using its resources), but without copying any source code or material from the Software. You may distribute those modules under the license of your choice, provided that this license is compatible with the terms of the Odoo Proprietary License (For example: LGPL, MIT, or proprietary licenses similar to this one). It is forbidden to publish, distribute, sublicense, or sell copies of the Software or modified copies of the Software. The above copyright notice and this permission notice must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Please log in to comment on this module