Skip to content

Instantly share code, notes, and snippets.

@adambard
Last active March 17, 2022 04:50
Show Gist options
  • Save adambard/e9823f94d3ff5de69ed9 to your computer and use it in GitHub Desktop.
Save adambard/e9823f94d3ff5de69ed9 to your computer and use it in GitHub Desktop.
TSTapstream *tracker = [TSTapstream instance];
// Call getConversionData to get the user's timeline history
[tracker getConversionData:^(NSData *jsonInfo) {
if(jsonInfo == nil)
{
// No conversion data available
}
else
{
NSError *error;
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:jsonInfo options:kNilOptions error:&error];
if(!json || error)
{
// No luck parsing the JSON
}
else
{
NSArray* hits = [json objectForKey:@"hits"];
if(!hits || [hits count] == 0)
{
// No hits in timeline
}
else
{
// Hit exists in timeline
NSDictionary* hit = [hits objectAtIndex:0]; // Grab the oldest hit
if(!hit)
{
// Couldn't get any hits
}
else
{
NSString* slug = [hit objectForKey:@"tracker"];
//Do something with the slug...
}
}
}
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment