Integration Guides

Odoo

Add Rybbit analytics to your Odoo site

The Odoo Website app has a Code Injection setting in the website editor's theme panel with separate <head> and </body> fields that apply to every page of the website. The snippet goes in the <head> field. This works on Odoo Online, Odoo.sh and on-premise installs of Odoo 17 and 18.

Get your tracking snippet

In your Rybbit dashboard, open Site Settings → Tracking Script and copy your snippet. It looks like this:

<script src="https://app.rybbit.io/api/script.js?siteId=YOUR_SITE_ID" defer></script>

YOUR_SITE_ID is the numeric ID of your site. If you self-host Rybbit, app.rybbit.io is the domain of your own instance.

Add the snippet to Odoo

  1. Open your website's frontend and click Edit in the top bar.
  2. Switch to the Theme tab of the editor panel.
  3. Scroll to the Advanced section and, next to Code Injection, click <head>.
  4. Paste the snippet into the editor that opens and click Save.
  5. Click Save in the website editor to publish the change.

The code is stored per website. If you run several websites from one Odoo database, switch website in the top bar and repeat the steps for each one.

Verify installation

Open your live site in a new tab and click through a few pages. Within a few seconds the pageviews appear in the Rybbit dashboard.

If nothing shows up:

  • View the page source and search for script.js?siteId= to confirm the snippet is on the page.
  • Open the browser Network tab and check that script.js returns 200 and that POST requests go to /api/track.
  • Disable ad blockers, or set up a proxy so the script loads from your own domain.
  • See the script troubleshooting guide for other common causes.

Track custom events

Odoo eCommerce pages render standard HTML, so use data-rybbit-event attributes on any element you add in the editor, or call window.rybbit.event() from the </body> Code Injection field:

<script>
  document.addEventListener("click", function (e) {
    if (e.target.closest("#add_to_cart")) {
      window.rybbit.event("add_to_cart");
    }
  });
</script>

The confirmation page is served at /shop/confirmation; a script that checks window.location.pathname there can send a purchase event once per order.

Troubleshooting

  • The <head> button is missing: Code Injection requires the Website → Editor and Designer access right. An administrator can grant it under Settings → Users & Companies → Users, on the user's Access Rights tab.
  • Change is visible while logged in but not for visitors: click Save in the editor after closing the code window; the code is published with the page.
  • Multiple websites: the field applies only to the website currently selected in the editor.

Next steps

On this page