Add tracking code
This commit is contained in:
parent
b0c63b8a3e
commit
833dc0e7c7
|
|
@ -736,6 +736,7 @@ CONSTANCE_CONFIG = {
|
|||
"Default value is empty and will not send any emails. (No regex support!)",
|
||||
),
|
||||
}
|
||||
TRACKING_TAG = env("IT_TRACKING_TAG", default="")
|
||||
|
||||
if APP_ENVIRONMENT == "local":
|
||||
# http://whitenoise.evans.io/en/latest/django.html#using-whitenoise-in-development
|
||||
|
|
|
|||
|
|
@ -58,6 +58,12 @@ def vue_home(request, *args):
|
|||
|
||||
# render index.html from `npm run build`
|
||||
content = loader.render_to_string("vue/index.html", context={}, request=request)
|
||||
# inject Plausible tracking tag
|
||||
if settings.TRACKING_TAG:
|
||||
content = content.replace(
|
||||
"</head>",
|
||||
f"\n{settings.TRACKING_TAG}\n</head>",
|
||||
)
|
||||
return HttpResponse(content)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue