Joomla
Step-by-step guide to add OnyxMetric cookieless analytics to your Joomla site and start tracking visitors
Joomla has no built-in head-code setting. Add the tag with a Custom module shown on every page, or put it in your template's index.php.
Copy your tracking snippet
In OnyxMetric, open your site's Site Settings and copy the tracking script. It looks like this:
<script src="https://app.onyxmetric.com/api/script.js?siteId=YOUR_SITE_ID" async></script>YOUR_SITE_ID is the numeric ID of your site.
Add the snippet to Joomla
No file edits, and the module survives template updates.
-
In the Administrator panel go to Content → Site Modules (Extensions → Modules on Joomla 3), click New, and choose Custom.
-
Set Title to
OnyxMetric, Show Title to Hide, and Position to any position your template renders on every page. -
In the editor, switch to code view (Toggle Editor) so the script is not stripped, then paste:
<script> (function () { var s = document.createElement("script"); s.src = "https://app.onyxmetric.com/api/script.js?siteId=YOUR_SITE_ID"; s.async = true; document.head.appendChild(s); })(); </script> -
Set Status to Published, choose On all pages under Menu Assignment, and click Save & Close.
Edit a child template (Joomla 4.1+) or your own copy. Changes to a stock template are lost on its next update.
-
Go to System → Site Templates and open the active template.
-
Open
index.phpand add the tag just before</head>:<script src="https://app.onyxmetric.com/api/script.js?siteId=YOUR_SITE_ID" async></script> </head> -
Click Save & Close.
Check that it works
Load your live site and click through a few pages. Pageviews show up in the OnyxMetric dashboard within seconds.
If nothing arrives:
- View the page source and search for
script.js?siteId=to confirm the tag is present. - In the browser's Network tab, check that
script.jsreturns200and that requests go to/api/track. - Turn off ad blockers, or proxy the script through your own domain.
- Read script troubleshooting for other causes.
Troubleshooting
- Module not on the page: confirm it is published, assigned to On all pages, and that the chosen position exists in your template. Then clear the cache.
- The editor strips the script: open the TinyMCE plugin settings under System → Plugins and allow
scriptelements with asrcattribute in the valid elements list, or switch the editor to None. - Page cache: the System - Page Cache plugin serves stored HTML, so clear the cache after adding the snippet.
Next steps
- Track custom events such as signups, purchases, and clicks.
- Identify users to tie sessions to accounts.
- Proxy the script through your own domain to get past ad blockers.
- Script attributes let you skip or mask URLs and tag events.