← All integration guides

Django

Serve the tracker from a Django template and keep configuration server-side.

Template integration

Expose the project tracking ID through template context or an environment-backed setting.

{% if ANALYTICA_TRACKING_ID %}
<script async src="{{ ANALYTICA_URL }}/analytica.js"></script>
<script>
  window.analytica = window.analytica || [];
  window.analytica.push(["init", {
    projectId: "{{ ANALYTICA_TRACKING_ID }}"
  }]);
</script>
{% endif %}

Track conversions

Emit named track events from views or after form posts so Goals with match type “event” can count them.

window.analytica.push(["track", "signup_completed"]);