ロケーションの追跡
エンゲージメント Mobile SDK 用の Salesforce CDP モジュールでは、すべてのイベントでロケーションを追跡できます。この機能を有効化するには、Salesforce CDP モジュールの setLocation メソッドを使用して coordinates と expiresIn を設定します。
iOS
Android
1// prepare the coordinates, use the CdpCoordinates wrapper
2let coordinates = CdpCoordinates(latitude: 54.187738, longitude: 15.554440)
3
4// set the location coordinates and expiration time in seconds
5CdpModule.shared.setLocation(coordinates: coordinates, expiresIn: 60)1CdpSdk.requestSdk { sdk >
2 // prepare the coordinates, use the Coordinates wrapper
3 val coordinates = Coordinates(latitude = 54.187738, longitude = 15.554440)
4
5 // set the location coordinates and expiration time in seconds
6 sdk.setLocation(coordinates = coordinates, expiresIn = 60)
7}SDK でロケーション座標の有効期限が残っている間は、イベント属性の latitude と longitude というキー名のキー値ペアに、ロケーション属性が自動的に付加されます。
有効期限が過ぎると、SDK ロケーション座標はクリアされ、イベントには付加されなくなります。座標の有効期限が過ぎる前にロケーションがイベントに付加されることを回避するには、setLocation をコールして、座標値として nil を指定します。