diff --git a/get_together/views/__init__.py b/get_together/views/__init__.py index 4b514f0..8eff573 100644 --- a/get_together/views/__init__.py +++ b/get_together/views/__init__.py @@ -55,7 +55,7 @@ def home(request, *args, **kwards): city = City.objects.get(id=request.GET.get("city")) context['city'] = city ll = [city.latitude, city.longitude] - ga.add_event(request, 'homepage_search', category='search', label='city', value=city.short_name) + ga.add_event(request, 'homepage_search', category='search', label=city.short_name) else : context['city_search'] = False try: diff --git a/get_together/views/events.py b/get_together/views/events.py index 4bb70dd..e7e3aeb 100644 --- a/get_together/views/events.py +++ b/get_together/views/events.py @@ -147,7 +147,7 @@ def create_event(request, team_id): new_event.save() messages.add_message(request, messages.SUCCESS, message=_('Your event has been scheduled! Next, find a place for your event.')) - ga.add_event(request, action='new_event', category='activity', label='event', value=new_event.get_full_url()) + ga.add_event(request, action='new_event', category='activity', label=new_event.get_full_url()) return redirect('add-place', new_event.id) else: diff --git a/get_together/views/new_team.py b/get_together/views/new_team.py index 3767eb6..bf50983 100644 --- a/get_together/views/new_team.py +++ b/get_together/views/new_team.py @@ -37,7 +37,7 @@ def start_new_team(request, *args, **kwargs): new_team.owner_profile = request.user.profile new_team.save() Member.objects.create(team=new_team, user=request.user.profile, role=Member.ADMIN) - ga.add_event(request, action='new_team', category='growth', label='team', value=new_team.name) + ga.add_event(request, action='new_team', category='growth', label=new_team.name) return redirect('define-team', team_id=new_team.pk) else: context = { diff --git a/get_together/views/new_user.py b/get_together/views/new_user.py index 8886b95..beacaa1 100644 --- a/get_together/views/new_user.py +++ b/get_together/views/new_user.py @@ -171,7 +171,7 @@ def user_send_confirmation_email(request): def user_confirm_email(request, confirmation_key): if request.user.account.confirm_email(confirmation_key): messages.add_message(request, messages.SUCCESS, message=_('Your email address has been confirmed.')) - ga.add_event(request, action='email_confirmed', category='activity', label='user', value=str(request.user.profile)) + ga.add_event(request, action='email_confirmed', category='activity', label=str(request.user.profile)) return redirect('confirm-notifications') else: diff --git a/simple_ga/api.py b/simple_ga/api.py index c18bb10..993abd2 100644 --- a/simple_ga/api.py +++ b/simple_ga/api.py @@ -2,7 +2,7 @@ class GAFailure(Exception): pass -def add_event(request, action, category=None, label=None, value=None, fail_silently=False): +def add_event(request, action, category=None, label=None, value=1, fail_silently=False): """ Attempt to add a message to the request using the 'messages' app. """ diff --git a/simple_ga/middleware.py b/simple_ga/middleware.py index 2fc2e08..60585ec 100644 --- a/simple_ga/middleware.py +++ b/simple_ga/middleware.py @@ -3,7 +3,7 @@ from django.utils.deprecation import MiddlewareMixin from django.utils.safestring import SafeData, mark_safe class GAEvent: - def __init__(self, action, category=None, label=None, value=None): + def __init__(self, action, category=None, label=None, value=1): self.action = action self.category = category self.label = label @@ -11,7 +11,7 @@ class GAEvent: def gtag(self): return mark_safe( - "gtag('event', '%(action)s', {'event_category' : '%(category)s', 'event_label' : '%(label)s' , 'event_value' : '%(value)s' });" % { + "gtag('event', '%(action)s', {'event_category' : '%(category)s', 'event_label' : '%(label)s' , 'value' : '%(value)s' });" % { 'action': self.action, 'category': self.category, 'label': self.label,