Adding additional data to track function in Mixpanel

Bronze Contributor
Bronze Contributor

The mixpanel "track" function allows for additional data to be set in a second parameter: mixpanel.track(pagename, {"Key": "value"});

 

How can I add this second parameter to "track"?

7 REPLIES 7

Adding additional data to track function in Mixpanel

Moderator
Moderator

mixpanel.png

Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Adding additional data to track function in Mixpanel

Moderator
Moderator


Hi Jordi,

All you need to do is map your data source, and instead of selecting an option from the mapping toolbox, enter the name of the "Key" that you want to map to. In the example above, the result would be:

mixpanel.track(<event_name>, {"email" : "test@test.com"});

I hope this helps. Please note I've just used email as an example - any data source will work in exactly the same way.

Craig.

Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Adding additional data to track function in Mixpanel

Bronze Contributor
Bronze Contributor
Hello Craig, There are some special properties in profile updates for Mixpanel. They require a particular syntax. How can you set this up in Tealium? https://mixpanel.com/help/reference/http#people-special-properties

Adding additional data to track function in Mixpanel

Moderator
Moderator

Hi Martijn,

 

The guide you are referring to is the HTTP specification, but we are using the JavaScript library. Having read through the spec, all the things described in the HTTP tracking guide are already supported by the Tealium JS template.

 

You can use the "set", "set_once" and "increment" mappings to call the relevant API functions. For example, to map "DOB" to the "people.set_once" API method, you would map data source "DOB" to the value "people.set_once.dob", and the resulting call to mixPanel would be something like:

 

mixpanel.people.set_once({"dob" : "01/01/1990"});

 

You can set as many of these properties as you wish.

 

I hope this helps. Merry Christmas :-)

 

Craig.

Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.

Adding additional data to track function in Mixpanel

Bronze Contributor
Bronze Contributor
Aha! I understand. Thanks!

Adding additional data to track function in Mixpanel

Bronze Contributor
Bronze Contributor

Craig, thanks for the details, though it seems .alias is missing, how is this done in Tealium? in Mixpanel you call mixpanel.alias("YOUR_USER_ID") so it should work how .identify does, but it doesn't have a mapping like identify does. @craig_rouse 


Adding additional data to track function in Mixpanel

Moderator
Moderator

@jmurano Although it doesn't have a mapping, if you manually map using the mapping name "alias", the tag template will automatically call the mixpanel.alias() method for you. I'll create an action internally to get the mapping options updated for the Mixpanel tag, as this really should be more obvious.

Check out our new Swift integration library for iOS, macOS, tvOS and watchOS: https://github.com/Tealium/tealium-swift with updated
documentation https://community.tealiumiq.com/t5/Swift/tkb-p/swift.
Public