Add user subscriptions categories to mixpanel

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent c7aec233ee
commit 317db4a86f
  1. 4
      apps/user/models.py
  2. 3
      apps/user/tasks.py

@ -100,6 +100,7 @@ def send_user_info_to_mixpanel(sender, instance=None, created=False, **kwargs):
instance.last_name,
instance.date_joined,
dict(User.ROLE_CHOICES).get(instance.role),
[subscription.title.lower() for subscription in instance.email_subscription.categories.all()] if hasattr(instance, 'email_subscription') else [],
)
@ -212,6 +213,9 @@ class SubscriptionCategory(models.Model):
verbose_name_plural = 'Категории подписки'
ordering = ('title',)
def __str__(self):
return self.title
class EmailSubscription(models.Model):
ERROR = 0

@ -6,7 +6,7 @@ from project.celery import app
@app.task
def user_to_mixpanel(user_id, email, first_name, last_name, date_joined, role):
def user_to_mixpanel(user_id, email, first_name, last_name, date_joined, role, subscriptions):
mix = Mixpanel(settings.MIX_TOKEN)
mix.people_set(
user_id,
@ -16,5 +16,6 @@ def user_to_mixpanel(user_id, email, first_name, last_name, date_joined, role):
'$last_name': last_name,
'$created': date_joined,
'role': role,
'subscriptions': subscriptions,
}
)

Loading…
Cancel
Save