Jasonette extension for integrating segment.io
See the iOS version here
- Install the extension using Jason Extension Manager
- Get an API key from segment.io
- From your Android studio project, open
strings.xml
. Add a new property calledsegment
, and add your API key there. Here's an example:
<string name="segment">genNIKQFiHP59px7DBtvypDCp0l7cVBA</string>
Implements identify
{
“type”: “$segment.identify”,
“options”: {
“id”: “…”,
“traits”: {…}
}
}
Implements tracking
{
“type”: “$segment.track”,
“options”: {
“event”: “…”,
“properties”: {
}
}
}
All $segment actions propagates the return value from its previous action onto the next action.
For example, take a look at this example:
{
"type": "$network.request",
"options": {
"url": "https://www.jasonbase.com/things/n3s.json"
},
"success": {
"type": "$segment.track",
"options": {
"result": "{{$jason}}"
},
"success": {
"type": "$render"
}
}
}
Above works the same as the following JSON (Except that the results are sent to segment.io between network.request
and render
)
{
"type": "$network.request",
"options": {
"url": "https://www.jasonbase.com/things/n3s.json"
},
"success": {
"type": "$render"
}
}
This is because the $segment.track
action propagates the $jason
object from $network.request
onto the next action ($render
)