Skip to content

Settings

To use django-umami efficiently, it's best to configure it exactly to your needs, right! To do this you can use either use environment variables or manually call the methods.

Using environment variables

.env
UMAMI_PAGE_URL=https://mysite.com
UMAMI_WEBSITE_ID=1234-1234-1234
UMAMI_TRACKING_ENABLED=True

Using umami object

Tip

Make sure to import any files needed first!

import django_umami.core

django_umami.core.umami.options...
import django_umami.decorators

@django_umami.decorators...
from django_umami.core import umami

umami.options...

Method - Set Host URL

Set Host URL

This allows you to set the main host URL of umami. This is only required if you have not set it via the UMAMI_PAGE_URL environment variable.

PARAMETER DESCRIPTION REQUIRED
host_url (string) Your analytics site url E.g. https://mysite.com
from django_umami.core import umami

umami.options.set_host_url("https://example.com")

Method - Set Website ID

Set Website ID

This allows you to set the main host URL of umami. This is only required if you have not set it via the UMAMI_WEBSITE_ID environment variable.

PARAMETER DESCRIPTION REQUIRED
website_id (string - uuid) Your website id E.g. 12345678-12345....
from django_umami.core import umami

umami.options.set_website_id("123456")

Method - Create Session

Using Sessions

Sessions allow for requests to your Umami server to be streamed in one session. This allows for requests to take around a third of the time a standard request would take!

from django_umami.core import umami

umami.options.create_session()