Skip to main content

Third Party Services

Google Analytics

The Google Analytics tracking code is at django_app/templates/core/components/google_analytics.html

You need to add GOOGLE_ANALYTICS_ID to the env variables to make it work.

Since we are using Turbo, so the tracking code should be placed in the event handler of turbo:load

document.addEventListener("turbo:load", function (event) {

})

If GA can not work with Turbo in your project, please check https://github.com/hotwired/turbo/issues/572

Google Tag Manager

The Google Tag Manager code is at django_app/templates/core/components/google_analytics.html

You need to add GOOGLE_GTM_ID to the env variables to make it work.

Notes:

  1. You need to config GA4 in GTM
  2. Please check Another Option: Track Single Page Applications with Google Tag Manager and Developer’s help to see how to setup GTM for Turbo
  3. Please remember to turn "Enhanced Measurement" off in GA4
page_view -> GTM -> GA4

PostHog

PostHog is an open-source product analytics platform that helps businesses understand how their users interact with their products. It allows companies to track user behavior, analyze data, and gain insights into how users engage with their products. PostHog provides a range of features including event tracking, user cohorts, A/B testing, and retention analysis, among others.

To use PostHog, all you need is to set POST_HOG_ID ENV then it will work automatically.

Google reCAPTCHA

To use Google reCAPTCHA, set below env variables

RECAPTCHA_PUBLIC_KEY
RECAPTCHA_PRIVATE_KEY

Sentry

To use Sentry to help you monitor the project, please set SENTRY_DSN to make it work.

To know how Sentry report errors in the frontend, please check frontend/src/components/sentry.js

MailGun

To make MailGun work on the production site, you need to set below env variables

USE_MAILHOG=0

DJANGO_DEFAULT_FROM_EMAIL=change-me
DJANGO_EMAIL_SUBJECT_PREFIX=change-me

MAILGUN_DOMAIN=change-me
MAILGUN_SENDER_DOMAIN=change-me
MAILGUN_API_KEY=change-me

MailChimp

When user signup, we can add the user to MailChimp subscribe list, you can add below envs to make it work

MAILCHIMP_API_KEY=change-me
MAILCHIMP_LIST_ID=change-me

Cloudflare

You can use some CDN services such as Cloudflare to speed up your site.

When you use Cloudflare with docker compose deployment solution, below are the things you might need to know:

  1. Celery Flower is working on 2053 because this is the HTTPS port supported by Cloudflare https://developers.cloudflare.com/fundamentals/get-started/reference/network-ports/
  2. Config the SSL Encryption modes to Full
  3. Do not let Cloudflare to help you auto redirects HTTP to HTTPS, this is also called Always Use HTTPS https://developers.cloudflare.com/ssl/edge-certificates/additional-options/always-use-https/. Because this might break the SSL renew in the Traefik.