mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 14:00:17 +02:00
Merge branch 'analytics' into 'master'
Analytics - Extra Ignore Path See merge request allianceauth/allianceauth!1347
This commit is contained in:
commit
fd8d43571a
@ -1,11 +1,11 @@
|
|||||||
# Generated by Django 3.1.13 on 2021-10-15 05:02
|
# Generated by Django 3.1.13 on 2021-10-15 05:02
|
||||||
|
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
def modify_aa_team_token_add_page_ignore_paths(apps, schema_editor):
|
def modify_aa_team_token_add_page_ignore_paths(apps, schema_editor):
|
||||||
# We can't import the Person model directly as it may be a newer
|
# Add /admin/ and /user_notifications_count/ path to ignore
|
||||||
# version than this migration expects. We use the historical version.
|
|
||||||
|
|
||||||
AnalyticsPath = apps.get_model('analytics', 'AnalyticsPath')
|
AnalyticsPath = apps.get_model('analytics', 'AnalyticsPath')
|
||||||
admin = AnalyticsPath.objects.create(ignore_path=r"^\/admin\/.*")
|
admin = AnalyticsPath.objects.create(ignore_path=r"^\/admin\/.*")
|
||||||
@ -17,8 +17,19 @@ def modify_aa_team_token_add_page_ignore_paths(apps, schema_editor):
|
|||||||
|
|
||||||
|
|
||||||
def undo_modify_aa_team_token_add_page_ignore_paths(apps, schema_editor):
|
def undo_modify_aa_team_token_add_page_ignore_paths(apps, schema_editor):
|
||||||
# nothing should need to migrate away here?
|
#
|
||||||
return True
|
AnalyticsPath = apps.get_model('analytics', 'AnalyticsPath')
|
||||||
|
Tokens = apps.get_model('analytics', 'AnalyticsTokens')
|
||||||
|
|
||||||
|
token = Tokens.objects.get(token="UA-186249766-2")
|
||||||
|
try:
|
||||||
|
admin = AnalyticsPath.objects.get(ignore_path=r"^\/admin\/.*", analyticstokens=token)
|
||||||
|
user_notifications_count = AnalyticsPath.objects.get(ignore_path=r"^\/user_notifications_count\/.*", analyticstokens=token)
|
||||||
|
admin.delete()
|
||||||
|
user_notifications_count.delete()
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
# Its fine if it doesnt exist, we just dont want them building up when re-migrating
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
40
allianceauth/analytics/migrations/0006_more_ignore_paths.py
Normal file
40
allianceauth/analytics/migrations/0006_more_ignore_paths.py
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Generated by Django 3.2.8 on 2021-10-19 01:47
|
||||||
|
|
||||||
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
|
from django.db import migrations
|
||||||
|
|
||||||
|
|
||||||
|
def modify_aa_team_token_add_page_ignore_paths(apps, schema_editor):
|
||||||
|
# Add the /account/activate path to ignore
|
||||||
|
|
||||||
|
AnalyticsPath = apps.get_model('analytics', 'AnalyticsPath')
|
||||||
|
account_activate = AnalyticsPath.objects.create(ignore_path=r"^\/account\/activate\/.*")
|
||||||
|
|
||||||
|
Tokens = apps.get_model('analytics', 'AnalyticsTokens')
|
||||||
|
token = Tokens.objects.get(token="UA-186249766-2")
|
||||||
|
token.ignore_paths.add(account_activate)
|
||||||
|
|
||||||
|
|
||||||
|
def undo_modify_aa_team_token_add_page_ignore_paths(apps, schema_editor):
|
||||||
|
#
|
||||||
|
AnalyticsPath = apps.get_model('analytics', 'AnalyticsPath')
|
||||||
|
Tokens = apps.get_model('analytics', 'AnalyticsTokens')
|
||||||
|
|
||||||
|
token = Tokens.objects.get(token="UA-186249766-2")
|
||||||
|
|
||||||
|
try:
|
||||||
|
account_activate = AnalyticsPath.objects.get(ignore_path=r"^\/account\/activate\/.*", analyticstokens=token)
|
||||||
|
account_activate.delete()
|
||||||
|
except ObjectDoesNotExist:
|
||||||
|
# Its fine if it doesnt exist, we just dont want them building up when re-migrating
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('analytics', '0005_alter_analyticspath_ignore_path'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RunPython(modify_aa_team_token_add_page_ignore_paths, undo_modify_aa_team_token_add_page_ignore_paths)
|
||||||
|
]
|
@ -59,13 +59,13 @@ def analytics_event(category: str,
|
|||||||
|
|
||||||
if allowed is True:
|
if allowed is True:
|
||||||
tracking_id = token.token
|
tracking_id = token.token
|
||||||
send_ga_tracking_celery_event.s(tracking_id=tracking_id,
|
send_ga_tracking_celery_event.s(
|
||||||
|
tracking_id=tracking_id,
|
||||||
client_id=client_id,
|
client_id=client_id,
|
||||||
category=category,
|
category=category,
|
||||||
action=action,
|
action=action,
|
||||||
label=label,
|
label=label,
|
||||||
value=value).\
|
value=value).apply_async(priority=9)
|
||||||
apply_async(priority=9)
|
|
||||||
|
|
||||||
|
|
||||||
@shared_task()
|
@shared_task()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user