from mixpanel import Mixpanel from django.conf import settings from project.celery import app @app.task def user_to_mixpanel(user_id, email, phone, first_name, last_name, date_joined, role, subscriptions): mix = Mixpanel(settings.MIX_TOKEN) mix.people_set( user_id, { '$email': email, '$phone': phone, '$first_name': first_name, '$last_name': last_name, '$created': date_joined, 'role': role, 'subscriptions': subscriptions, } )