Set the Location's Site Name with the Aternity iOS Mobile SDK (setSite and setOffSite)

You can set the location's site name for a mobile app in the Aternity Mobile SDK, to track the performance of all end users in that location. In iOS, the Aternity class provides two static methods for setting the site: setSite to define the site name, and setOffSite to define the site as Off-site.

Set the site name to correspond to the Site field in your organization's Microsoft Active Directory, so Aternity can automatically map the site to its Country, State and City in the dashboards. For more information see how to configure location mapping.

In addition to using this method, you can also set this property when the iOS app initializes with activateWithDictionary and setting the property ATERNITY_CONFIG_SITE.

Using the site-based location of monitored mobile apps

Before You Begin

Before you begin, ensure you have already done the following:

Method Definition

In iOS, the Aternity class provides two static methods for setting the site: setSite to define the site name, and setOffSite to define the site as Off-site.

+(void)setSite:(NSString *)newSite;
+(void)setOffSite;
Parameter Description

newSite

Set the site name of device's location's site name to this value, which should correspond to the Site name in your Microsoft Active Directory.

Example

This example queries the name (SSID) of the connected WiFi network to determine the location's site name. If the network names are not recognized, it sets the name to Off-Site.

In Objective-C:

//No need to use the singleton object as these are static methods.

if([wifiSSID isEqualToString:@"AP-1"])
	[Aternity setSite:@"Warehouse"];
else if([wifiSSID isEqualToString:@"AP-2"])
	[Aternity setSite:@"Sales"];
else
	[Aternity setOffSite];

In Swift:

//No need to use the singleton object as these are static methods.

if wifiSSID=="AP-1" {
	Aternity.setSite("Warehouse")
}
else if wifiSSID=="AP-2" {
	Aternity.setSite("Sales");
}
else {
	Aternity.setOffSite();
}