デバイスの「広告識別子」(ADID)を使用して、ディスプレイ広告ネットワークとのインタラクションを識別できるようにします。
要件
インストール
広告識別子モジュールは、Maven または手動でインストールします。
Maven
Maven を使用して広告識別子モジュールをインストールするには、次の手順を実行します。
プロジェクトの最上位の
build.gradleファイルに、次の Maven リポジトリを追加します。maven { url "https://maven.tealiumiq.com/android/releases/" }プロジェクトモジュールの
build.gradleファイルに、次の Maven 依存関係を追加します。dependencies{ implementation 'com.tealium:library:5.8.0' //only required if you do not have this reference implementation 'com.tealium:adidentifier:1.0.4' implementation 'com.tealium:lifecycle:1.1.4' //only required if you do not already have this reference and require lifecycle tracking }Tealium ライブラリをインスタンス化するブロック内で、Tealium をインスタンス化した後に次のコードを追加します。
// import the Tealium AdIdentifier module in the import section import com.tealium.adidentifier.AdIdentifier; // context to pass to AdIdentifier module Context mContext = this; // substitute the example instance name here with the same instance name you used when initializing the Tealium library private static final String TEALIUM_INSTANCENAME = "INSTANCE_NAME"; // call this to store the referrer as Persistent data - recommended AdIdentifier.setIdPersistent(TEALIUM_INSTANCENAME, mContext); // call this to store the referrer as Volatile data (reset at app restart/terminate) - not recommended in most cases AdIdentifier.setIdVolatile(TEALIUM_INSTANCENAME, mContext);
手動
広告識別子モジュールを手動でインストールするには、次の手順を実行します。
Tealium の AdIdentifier モジュールをダウンロードします。
最上位の
build.gradleファイルで、次の構成を確認します。allprojects { repositories { mavenCentral() flatDir { dirs 'libs' } } }tealium.adidentifier-1.0.4.aarファイルを、プロジェクトの<PROJECT_ROOT>/<MODULE>/libsディレクトリにコピーします。プロジェクトモジュールの
build.gradleファイルに、Tealium ライブラリの依存関係を追加します。dependencies { // only required if you do not already have this reference implementation (name:'tealium-5.8.0', ext:'aar') implementation (name:'tealium.adidentifier-1.0.4', ext:'aar') // only required if you do not already have this reference and require lifecycle tracking implementation (name:'tealium.lifecycle-1.1.4', ext:'aar') }
その他の考慮事項
アクセスがブロックされている場合
ユーザーが広告識別子へのアクセスを許可していない場合、モジュールはgoogle_adid変数を文字列「Ad Tracking Disabled」に構成します。サードパーティベンダーに想定どおりのデータが渡されるように、この値はタグ管理の構成で処理されます。広告識別子の削除
保存されている広告識別子の文字列を削除するには、Tealium ライブラリが提供する標準メソッドを呼び出し、永続保存または揮発性保存から変数を削除します。この変数のキー名は、TealiumAdIdentifierクラスによって公開されています。次の例では、保存されている広告識別子を永続データと揮発性データの両方から削除します。変数が存在しない場合、このコードは何も実行せず、エラーもスローしません。```java // import the Tealium AdIdentifier module in the import section import com.tealium.adidentifier.AdIdentifier; private static final String TEALIUM_INSTANCENAME = "INSTANCE_NAME"; final Tealium instance = Tealium.getInstance(TEALIUM_INSTANCENAME); // remove from persistent data store instance.getDataSources().getPersistentDataSources().edit().remove(AdIdentifier.KEY_GOOGLE_ADID).apply(); // remove from volatile data store (session only) instance.getDataSources().getVolatileDataSources().remove(AdIdentifier.KEY_GOOGLE_ADID); ```
データレイヤー
広告識別子モジュールは、次の変数をデータレイヤーに追加します。
| 変数 | 型 | 説明 | 例 |
|---|---|---|---|
google_adid | String | Google 広告識別子 ID | ca-app-pub-0123456789012345~0123456789 |
API リファレンス
広告識別子モジュールのメソッドに関する完全なリファレンスについては、Tealium SDK for Android API の AdIdentifier クラスを参照してください。
最終更新日 :: 2018年November月7日