Skip to content
This repository has been archived by the owner on Aug 18, 2024. It is now read-only.

Commit

Permalink
Add Plausible support (#373)
Browse files Browse the repository at this point in the history
* Add Plausible support

* Upgrade deps
  • Loading branch information
HON95 authored Oct 4, 2022
1 parent 84f9841 commit 0c7d6bb
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security


## [v1.10.4] - 2022-10-04

### Added

- Added Plausible support for anonymous analytics.

## [v1.10.3] - 2022-09-17

### Added
Expand Down
3 changes: 3 additions & 0 deletions apps/misc/context_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@ def global_variables(request):
'app_version': getattr(settings, 'VERSION', ''),
'support_mail': getattr(settings, 'SUPPORT_MAIL', ''),
'stripe_public_key': getattr(settings, 'STRIPE_PUBLIC_KEY', ''),
'plausible_enable': getattr(settings, 'PLAUSIBLE_ENABLE', ''),
'plausible_local_domain': getattr(settings, 'PLAUSIBLE_LOCAL_DOMAIN', ''),
'plausible_remote_domain': getattr(settings, 'PLAUSIBLE_REMOTE_DOMAIN', ''),
'full_app_name': build_full_app_name,
}
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ flake8-comprehensions==1.4.1
# via -r requirements/test.in
flake8-import-order==0.18.1
# via -r requirements/test.in
flake8-logging-format==0.7.5
flake8-logging-format==0.8.1
# via -r requirements/test.in
flake8-mutable==1.2.0
# via -r requirements/test.in
Expand Down Expand Up @@ -139,7 +139,7 @@ six==1.16.0
# python-dateutil
soupsieve==1.9.6
# via beautifulsoup4
stripe==4.1.0
stripe==4.2.0
# via -r requirements/base.in
typing==3.10.0.0
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements/all.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ flake8-comprehensions==1.4.1
# via -r requirements/test.in
flake8-import-order==0.18.1
# via -r requirements/test.in
flake8-logging-format==0.7.5
flake8-logging-format==0.8.1
# via -r requirements/test.in
flake8-mutable==1.2.0
# via -r requirements/test.in
Expand Down Expand Up @@ -136,7 +136,7 @@ six==1.16.0
# python-dateutil
soupsieve==1.9.6
# via beautifulsoup4
stripe==4.1.0
stripe==4.2.0
# via -r requirements/base.in
typing==3.10.0.0
# via
Expand Down
4 changes: 2 additions & 2 deletions requirements/development.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ flake8-comprehensions==1.4.1
# via -r requirements/test.in
flake8-import-order==0.18.1
# via -r requirements/test.in
flake8-logging-format==0.7.5
flake8-logging-format==0.8.1
# via -r requirements/test.in
flake8-mutable==1.2.0
# via -r requirements/test.in
Expand Down Expand Up @@ -134,7 +134,7 @@ six==1.16.0
# python-dateutil
soupsieve==1.9.6
# via beautifulsoup4
stripe==4.1.0
stripe==4.2.0
# via -r requirements/base.in
typing==3.10.0.0
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ six==1.16.0
# python-dateutil
soupsieve==1.9.6
# via beautifulsoup4
stripe==4.1.0
stripe==4.2.0
# via -r requirements/base.in
tzlocal==2.1
# via pychallonge
Expand Down
4 changes: 2 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ flake8-comprehensions==1.4.1
# via -r requirements/test.in
flake8-import-order==0.18.1
# via -r requirements/test.in
flake8-logging-format==0.7.5
flake8-logging-format==0.8.1
# via -r requirements/test.in
flake8-mutable==1.2.0
# via -r requirements/test.in
Expand Down Expand Up @@ -130,7 +130,7 @@ six==1.16.0
# python-dateutil
soupsieve==1.9.6
# via beautifulsoup4
stripe==4.1.0
stripe==4.2.0
# via -r requirements/base.in
typing==3.10.0.0
# via
Expand Down
5 changes: 5 additions & 0 deletions setup/local.template.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,10 @@
CHALLONGE_API_USERNAME = ''
CHALLONGE_API_KEY = ''

# Plausible
PLAUSIBLE_ENABLE = False
PLAUSIBLE_LOCAL_DOMAIN = 'localhost'
PLAUSIBLE_REMOTE_DOMAIN = 'localhost'

# Show studlan version in footer
SHOW_VERSION = False
5 changes: 5 additions & 0 deletions studlan/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,11 @@
# Overiding messagetags to match bootstrap 3
MESSAGE_TAGS = {message_constants.ERROR: 'danger'}

# Plausible
PLAUSIBLE_ENABLE = False
PLAUSIBLE_LOCAL_DOMAIN = 'localhost'
PLAUSIBLE_REMOTE_DOMAIN = 'localhost'

# Version
VERSION = 'Unknown version'
version_file_path = os.path.join(PROJECT_ROOT_DIRECTORY, 'VERSION')
Expand Down
5 changes: 5 additions & 0 deletions templates/base.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{% load i18n %}
{% load misc %}
{% load static %}
{% load tz %}

Expand Down Expand Up @@ -26,6 +27,10 @@
<script src="{% static 'js/jquery.fitvids.js' %}"></script>
<script src="{% static 'js/bootstrap.min.js' %}"></script>
<script src="{% static 'js/custom.js' %}"></script>

{% if plausible_enable %}
<script defer data-domain="{{ plausible_local_domain }}" src="https://{{ plausible_remote_domain }}/js/plausible.js"></script>
{% endif %}
</head>

<body>
Expand Down

0 comments on commit 0c7d6bb

Please sign in to comment.