You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

32 lines
649 B

from mixpanel import Mixpanel
from django.conf import settings
from project.celery import app
@app.task
def transaction_to_mixpanel(user_id, amount, time, product_type):
mix = Mixpanel(settings.MIX_TOKEN)
mix.people_track_charge(
user_id,
amount,
{
'$time': time,
'product_type': product_type,
}
)
@app.task
def product_payment_to_mixpanel(user_id, event_name, time, properties):
mix = Mixpanel(settings.MIX_TOKEN)
props = {
'$time': time,
}
props.update(properties)
mix.track(
user_id,
event_name,
properties=props,
)