Question

Tracking affiliate referral events and sending events and properties to multiple profiles using JavaScript SDK

  • 19 July 2020
  • 1 reply
  • 123 views

  • New Participant
  • 1 reply

A little stumped, I hope someone can get me through.

We’re using Mixpanel for a basic affiliate tracking system and I’m trying to update the referrer (affiliate) profile at the time a successful signup is made using their code. I have configured it using GTM whereby I use mixpanel.identify(affiliate_id) of the affiliate ID and then revert back to mixpanel.identify(new_account_id), but no matter how the tags fire, the events are always going to the new_account_profile.

The difficult part for me to process is that it works if I run it through the console. I understand that mixpanel.identify(new_account_id) may have been run in a previous tag but I would have thought that by identifying again this would have cleared the previous identifications, am I mistaken? I have event tried mixpanel.reset() before the re-identification, to no avail also.

  mixpanel.identify(affiliate_id);

  mixpanel.track("Friend Joined", {"Friend (Public ID)": new_account_id,"Plan Name": "{{DLV - Membership Plan}}","Plan Type Name":"{{DLV - plan_type_name}}"});


If anyone has ideas on how I can solve for this, I’m all ears. TIA.


1 reply

Userlevel 1
Badge +2

Hey there,

Just to clarify, you have a profile with an affiliate ID and another profile with the new_account_id in the same mixpanel project -- is that correct?

And from there, you’re trying to send events to both profiles or specify which profile events go to?

If events can be tied to an affiliate and an account, you may want to think about adding on group analytics that lets you use one of the id’s as the group key that you can switch / pivot to within the tool:

https://help.mixpanel.com/hc/en-us/articles/360025333632-Group-Analytics

Otherwise, to send events to both, I would have also thought about approaching the reset() function then identify() afterwards to get the events to tie to the user you want to, but would love to learn more about what went wrong there.


Ian

Reply


Mixpanel