Highlighted

How to send custom mixpanel events

Rookie Contributor

Hi, we just started using tealium with mixpanel.
We have multiple custom events in mixpanel and I'm wondering how to setup this with tealium's utag.
What we used to do is something like:

mixpanel.track('eventName', { ...eventProperties })

Now, if I'm understanding this correctly the way to do this with tealium's utag is something like:

utag.track(tealium_event: 'track', ...eventProperties)

In the previous example it's unclear where to specify the custom event string.
Anyone know show to specify this custom event string?
Thanks :)

3 REPLIES 3
Highlighted

How to send custom mixpanel events

Tealium Employee

Hi @jbalandranocoro 

 

Here is a link to a previous post that may help:

https://community.tealiumiq.com/t5/Tealium-iQ-Tag-Management/utag-track-method/m-p/24578

Additionally here is the documentation for the tracking events:

https://docs.tealium.com/platforms/javascript/track/

 

Please let me know if this helps.

Highlighted

How to send custom mixpanel events

Tealium Employee

Hi @jbalandranocoro 

 

I just realized that you may have been asking how to trigger events within the MixPanel Tag within TiQ:

aginteractive | bluemountain 2020-06-26 10-34-14.png

In your example, you want to send an event like:

mixpanel.track('eventName', { ...eventProperties })

 This can be achieved through Data Mappings.  For example, if you wanted to track when a user adds something to their cart and also pass the product_id here are the steps:

Let's say when a customer clicks add to cart on the site, an event listener triggers a utag.link event and passes this object:

{
tealium_event : "cart_add",
product_id : ["123456"]
}

Knowing this, within Tealium we can configure the MixPanel to send that event like so:

1. Open the Data Mappings within MixPanel and choose the variable tealium_event and within the mappings:

  • Select Events in the Category Column
  • set the trigger, in this case, we want to trigger a track event whenever tealium_event equals cart_add

 

Screen Shot 2020-06-26 at 10.46.11 AM.png 2020-06-26 10-46-36.png

2. Next, we can pass an event name, within this example, we can use cart_add, since that is also the name of our event.

  • Select tealium_event from the dropdown
  • within the mappings section, go to Event in the left column
  • In the first drop down we want to choose which event tealium_event will be associated with, in this case Track
  • In the second dropdown, we can choose wheretealium_event is assigned within that event, in this case, Event Name

Screen Shot 2020-06-26 11-08-23.png

3. Lastly, we will want to configure product_id to be sent whenever the cart_add event occurs.  

  • Select product_id from the dropdown
  • within the mappings section, go to Event Parameters in the left column
  • In the first drop down we want to choose which event tealium_event will be associated with, in this case Track

In the second dropdown, we can choose where cart_add is assigned within that event, in this case, Event NameScreen Shot 2020-06-26 10-58-08.png

After we complete the data mappings and publish.  When a user clicks on an Add to Cart Button, the tag will fire and pass this event:

mixpanel.track('cart_add', { product_id : "12345" })

If you want to look at the Tag Template, it may help you get a better idea of how the code is being processed, for example here is the mixpanel.track function at work:

services-nam-ngo | main 2020-06-26 11-16-26.png

To view the tag template, it is within the Advanced Settings of the Tag Configurations.

https://community.tealiumiq.com/t5/iQ-Tag-Management/Managing-Tag-Templates/ta-p/21713

 

Good luck and let me know if that helps.

 

 

Highlighted

How to send custom mixpanel events

Rookie Contributor

Thank you, this was really helpful and something I didn't find in Tealium's documentation.
Looking at the template was also super helpful and it's bit difficult to get there as a first time Tealium user.

Hope y'all can add this to Tealium's documentation, thanks!