Template
Add campaign UTM links and piha.li shortener as a core helper.
Keep mint/UTM in always-on core so email_sms and directmail stay optional, and brand utm_source from SITE_NAME (or UTM_SOURCE) instead of a hardcoded client name. Closes #3
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from urllib.parse import urlparse
|
||||
|
||||
@@ -364,6 +365,20 @@ NOMINATIM_USER_AGENT = env(
|
||||
)
|
||||
NOMINATIM_API_KEY = env("NOMINATIM_API_KEY", "")
|
||||
|
||||
# --- URL shortener (piha.li) ---
|
||||
# Call the API host, never the public short domain. Empty = skip minting
|
||||
# (composer falls back to the long UTM URL). Token format: name:secret.
|
||||
# Required in beta/prod when FEATURE_EMAIL_SMS or FEATURE_DIRECT_MAIL is on.
|
||||
SHORTENER_BASE_URL = env("SHORTENER_BASE_URL", "")
|
||||
SHORTENER_API_TOKEN = env("SHORTENER_API_TOKEN", "")
|
||||
SHORTENER_TIMEOUT_SECONDS = int(env("SHORTENER_TIMEOUT_SECONDS", "10") or "10")
|
||||
# Optional override for utm_source. Empty → slug of SITE_NAME.
|
||||
UTM_SOURCE = env("UTM_SOURCE", "")
|
||||
# manage.py test must not mint against a live API (env often has prod tokens).
|
||||
if "test" in sys.argv:
|
||||
SHORTENER_BASE_URL = ""
|
||||
SHORTENER_API_TOKEN = ""
|
||||
|
||||
# --- Tianji analytics (pageviews + events; notice banner, not opt-in) ---
|
||||
TIANJI_ENABLED = env_bool("TIANJI_ENABLED", not DEBUG)
|
||||
TIANJI_TRACKER_URL = env(
|
||||
|
||||
Reference in New Issue
Block a user