Hugo Integration
Add Ovyxa analytics to your Hugo static site by including the tracking script in a partial template.
Step 1: Create or Edit the Head Partial
Create (or edit) the file layouts/partials/ovyxa.html:
layouts/partials/ovyxa.html
<script
defer
data-domain="yourdomain.com"
src="https://ovyxa.com/js/script.js"
></script>
Step 2: Include the Partial
Add the partial to your base layout. Edit layouts/_default/baseof.html (or your theme's equivalent) and add it inside <head>:
layouts/_default/baseof.html
<head>
{{ partial "ovyxa.html" . }}
<!-- ... other head content ... -->
</head>
If you're using a theme that supports custom head content, you may already have a layouts/partials/head.html or layouts/partials/extend-head.html file. Add the script there instead.
Using Config for the Domain
Make the domain configurable via config.toml:
config.toml
[params]
ovyxaDomain = "yourdomain.com"
Then reference it in your partial:
layouts/partials/ovyxa.html
{{ with .Site.Params.ovyxaDomain }}
<script
defer
data-domain="{{ . }}"
src="https://ovyxa.com/js/script.js"
></script>
{{ end }}
Tracking Custom Events
Add event tracking in your templates or content pages:
<button onclick="window.ovyxa('event', 'Download', { props: { file: 'guide.pdf' } })">
Download Guide
</button>
Or from a JavaScript file:
window.ovyxa('event', 'NewsletterSignup', { props: { source: 'sidebar' } })
Cookieless Mode
Add data-cookieless to skip cookie consent requirements:
<script
defer
data-domain="yourdomain.com"
data-cookieless
src="https://ovyxa.com/js/script.js"
></script>
Verify Installation
- Build and serve your site (
hugo server) - Visit the local or deployed site
- Open the browser Network tab and look for a request to
ovyxa.com/js/script.js - Check your Ovyxa dashboard to confirm pageviews are appearing