Solved

Integrating Mixpanel in SwiftUI: how do I indicate event properties?

  • 6 May 2020
  • 1 reply
  • 61 views

Hey guys! 

I was able to set up Mixpanel in my iOS poetry app, I see some basic events appear on my account using

.onAppear() {
Analytics.instance.track(event: .eventName)
}

How do I indicate the property of the event? For example, there are several ways for users to visit a poet page — via poets list, via search, or via poem. Could you explain or point me to the article that best explain how to implement such use-cases in SwiftUI?

Thanks!

icon

Best answer by stephanie 7 May 2020, 00:09

Hi @arkushi,

Here is an example on how to set a property in Mixpanel-Swift,

Mixpanel.mainInstance().track(event: "EVENT-NAME",
properties: ["PROPERTY" : "VALUE"])

In your case, it might looks something like this,

Analytics.instance.track(event: .eventName, 

properties: ["Poem" : "Stufen",  "Poet Name": "Herman Hesse"])

You can read more on on our implementing Mixpanel-Swift in our dev docs here

View original

1 reply

Userlevel 5
Badge +4

Hi @arkushi,

Here is an example on how to set a property in Mixpanel-Swift,

Mixpanel.mainInstance().track(event: "EVENT-NAME",
properties: ["PROPERTY" : "VALUE"])

In your case, it might looks something like this,

Analytics.instance.track(event: .eventName, 

properties: ["Poem" : "Stufen",  "Poet Name": "Herman Hesse"])

You can read more on on our implementing Mixpanel-Swift in our dev docs here

Reply