hzh
hzh

Reputation: 41

Add Aldryn Google Analytics to Django CMS

I currently have a django cms website and will like to have google analytics installed, using the aldryn-google-analytics plugin.

I don't have a Divio Cloud account, and I'm really new to python.

May I seek your advice on the GitHub files to be added to my project please and where the files should be placed into project.

Upvotes: 1

Views: 784

Answers (2)

Daniele Procida
Daniele Procida

Reputation: 1539

  • If you're using Divio Cloud for your django CMS project, the Google Analytics addon can be a good way to add Google Analytics to a site (useful if you are for example a web manager who doesn't have access to site code).

  • If you're not, just copy and paste the JS snippet provided by Google into your template.

In fact you can do that even if you're on Divio Cloud.

Upvotes: 1

markwalker_
markwalker_

Reputation: 12859

Doesn't look like you need a Divio Cloud account. Looks like it just needs some settings defined. Take a look at this part of that app;

google_analytics_id = getattr(settings, 'GOOGLE_ANALYTICS_ID', None)
use_universal_analytics = getattr(settings, 'GOOGLE_ANALYTICS_USE_UNIVERSAL', False)
track_individuals = getattr(settings, 'GOOGLE_ANALYTICS_TRACK_INDIVIDUALS', False)

From that, you can see it'll work if you provide your analytics ID as the following setting in your django settings file; GOOGLE_ANALYTICS_ID

You can also optionally enable the following two settings (True or False) to enable those features; GOOGLE_ANALYTICS_USE_UNIVERSAL, GOOGLE_ANALYTICS_TRACK_INDIVIDUALS

Alternatively you could just drop the javascript from analytics in to your templates. Usually it's easy to just include it in a base.html that gets inherited in to all pages.

Upvotes: 0

Related Questions