Skip to content

Segment.io Integration

IOS

1.After Segment initialisation, simply pass segment anonymousId into Pointzi/Streethawk register function

[StreetHawk registerInstallForApp:<appKey> segmentId:[[SEGAnalytics sharedAnalytics] getAnonymousId] withDebugMode:YES];

2.Pointzi/StreetHawk provides a SHInstallRegistrationSuccessNotification to inform notification center about initialisation of SDK is done. Therefore, please register a notification as

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(installRegisterSuccessHandler:) name:SHInstallRegistrationSuccessNotification object:nil];

3.Please call segment api such as sending traits in the callback function installRegisterSuccessHandler

- (void)installRegisterSuccessHandler:(NSNotification *)notification
{
   //Sample code to send segment traits after Streethawk is ready
   [[SEGAnalytics sharedAnalytics] identify:@"myuser@acme.com"
                     traits:@{
                          @"sh_cuid": @"myuser@streethawk",
                          @"email": @"myuser@acme.com",
                          @"gender": @"male",
                          @"phone": @"+14088123123"
                      }];
}
4. Go to your Segment.io Dashboard

Please add the above webhook URL in your segment.io destinations.

https://bison.streethawk.com/v3/hooks/segment/?auth_token="Your Pointzi Auth Token"&app_key="Your Pointzi App Key"

To get the "Pointzi Auth Token" and "Pointzi App Key" go to the Pointzi Dashboard Settings and choose from the API Tab.

Pointzi Dashboard Settings

Android

1.After Segment initialisation, simply pass segment anonymousId into Pointzi/Streethawk register function

Pointzi.INSTANCE.init(getApplication, "MyAppKey",  "anonymousID");
Note to get your anonymousID you can do:
 com.segment.analytics.Analytics.with(MyActivity.this)
                .getAnalyticsContext()
                .traits()
                .anonymousId()

2.Pointzi/StreetHawk provides a ISHEventObserver to inform notification center about initialisation of SDK is done. Therefore, please register a notification as

public class MyActivity .... implements ISHEventObserver {
.......
Pointzi.INSTANCE.init(getApplication, "MyAppKey",  "anonymousID", this);
.......

@Override
public void onInstallRegistered(String installId){
}

@Override
public void onInstallRegisterError(String errorMsg) {
}

3.Please call segment api such as sending traits in the callback function onInstallRegistered

@Override
public void onInstallRegistered(String installId){
    com.segment.analytics.Analytics.with(MainActivity.this).identify(
            new com.segment.analytics.Traits().putName("Michael Bolton"));
}
4. Go to your Segment.io Dashboard

Please add the above webhook URL in your segment.io destinations.

https://bison.streethawk.com/v3/hooks/segment/?auth_token="Your Pointzi Auth Token"&app_key="Your Pointzi App Key"

To get the "Pointzi Auth Token" and "Pointzi App Key" go to the Pointzi Dashboard Settings and choose from the API Tab.

Pointzi Dashboard Settings