New Relic では、Apple の ベンダー ID を使用して特定のデバイスを追跡し、ユーザー数を正確に把握しています。ベンダーIDの特徴は、同じバンドルIDベースを使用している一連のアプリ間でユニークであることです。例えば、 com.company-name.*
のように、同じバンドル ID を使用するアプリ間でベンダー ID は同じです。
この記事では、隠しAPIを使用して、このクロスアプリの識別子を不明瞭にする方法を説明します(iOS agentバージョン6.11.0で利用可能)。
+[NewRelic saltDeviceUUID:(BOOL)enabled]
デバイスのuuidを有効にする salt
隠しメソッド +[NewRelic saltDeviceUUID:(BOOL)enabled]
にアクセスするには、 NewRelic
オブジェクトにカテゴリーを追加します。
@interface NewRelic (salt) + (void) saltDeviceUUID:(BOOL)enabled;@end
これは、 AppDelegate.h
の中で、 #include<NewRelic/NewRelic.h>
の後、 @implementation AppDelgate
の前に追加することができます。
//
// AppDelegate.m
//
// Created on 9/11/12.
// © 2012 New Relic, Inc. All rights reserved.
//
#import "AppDelegate.h"
#import <NewRelic/NewRelic.h>
@interface NewRelic (salt)
+ (void) saltDeviceUUID:(BOOL)enabled;
@end
@implementation AppDelegate
// code
@end
APIの呼び出し
次に、 [NewRelic saltDeviceUUID:YES];
の前に [NewRelic startWithApplicationToken:]を呼び出します。
//
// AppDelegate.m
//
// Created on 9/11/12.
// © 2012 New Relic Inc. All rights reserved.
//
#import "AppDelegate.h"
#import <NewRelic/NewRelic.h>
@interface NewRelic (salt)
+ (void) saltDeviceUUID:(BOOL)enabled;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[NewRelic saltDeviceUUID:YES];
[NewRelic startWithApplicationToken:@"MY_TOKEN"];
...
}
...
@end
New Relic に送信されるすべてのイベントやデータにおいて、デバイス ID が難読化されるようになりました。