๐Ÿ“ŠGoogle Analytics

Adding your Google Analytics tag to your PySaaS application

Choice of adding Google Analytics

By default, Google Analytics is disabled on your PySaaS application. You do not have to add your Google Analytics tag to track information on users of your site. However, if you want to include this feature, it is very simple to do.

Setting up and configuring Google Analytics itself is outside of the scope of PySaaS and will not be covered in this documentation. Please refer to Google's documentation to properly get this set up on their side.

Configure Google Analytics

To enable Google Analytics, edit your .env file to change the FALSE value to TRUE and add your Google Analytics tag in the line below that:

##### Google Analytics #####
# Options: TRUE, FALSE
GOOGLE_ANALYTICS="TRUE"
GOOGLE_TAG="G-XXXXXXXXXX"

The way that this works is in the pysaas.py file where the Reflex app is declared, PySaaS checks your .env file for the GOOGLE_ANALYTICS environment variable. If it is set to TRUE, it will add the proper script tags to the top of the body section of each page of your site.

Last updated