# Advertising ID

### Netmera Ad\_ID Integration

The Netmera SDK provides the ability to retrieve the **Ad\_ID** (Advertising Identifier) for users. This device identifier allows for targeted actions that help you better understand and engage with your users, although it is not used for displaying advertisements. Instead, the Ad\_ID is a key variable for tracking user interactions and behavior.

{% hint style="success" %}
**Ad\_ID Usage**

* The **Ad\_ID** is a unique identifier tied to each user's device.
* It is not used for advertisements within your app but for tracking user activity and enabling more personalized communication and campaigns.
  {% endhint %}

### Accessing Ad\_ID Information

You can access the **Ad\_ID** under the **Settings > User** section in the **Netmera Panel**. This data can then be leveraged for personalized user engagement and strategic decision-making.

### Ad\_ID Integration Steps

#### Step 1: Import AppTrackingTransparency Framework

Import the `AppTrackingTransparency` framework at the beginning of your Swift file where you handle the Ad\_ID integration.

```swift
import AppTrackingTransparency
```

#### Step 2: Request Tracking Authorization

Import the `AppTrackingTransparency` framework in your Swift file to manage tracking requests. Use the following code is used to request `AdId` permission.&#x20;

* This request will prompt the user to either opt-in or opt-out of ad tracking. Be sure to handle the user's response based on their choice.

{% tabs %}
{% tab title="Swift" %}

```swift
Netmera.requestTrackingAuthorization()
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
[Netmera requestTrackingAuthorization];
```

{% endtab %}
{% endtabs %}

#### Step 3: Adding a Key to your Plist File

Add the 'Privacy - Tracking Usage Description' key to your Info.plist file to inform users why you are requesting access to their advertising identifier For more information, please refer to the [Apple documentation](https://developer.apple.com/documentation/bundleresources/information_property_list/nsusertrackingusagedescription).&#x20;

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FDe4jX4b8LxCmI8V1TdxA%2Funnamed%20(1).png?alt=media&#x26;token=9e253ecc-dd5a-4012-967e-6412a823e688" alt=""><figcaption></figcaption></figure>

#### Step 4: Enable Advertising ID Used in App Config

To use the advertising identifier, you need to enable it in your app's configuration settings:

1. Open **Xcode**.
2. Navigate to your app’s **target settings**.
3. Under the **Info** tab, find **App Config**.
4. Locate the **Advertising Id Used** option and ensure it is enabled.

This step is crucial to allow the use of the advertising identifier in your app.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FvPeyPbxetwRuVmVdIWKo%2Fimage.png?alt=media&#x26;token=3a7e0f90-8d49-4a4e-9bf7-3a0660755b69" alt=""><figcaption></figcaption></figure>

### Example Code Snippets

#### Setting Authorized Advertising Identifier

You can enable or disable Ad\_ID permission within your app using the following code:

{% tabs %}
{% tab title="Swift" %}

```swift
Netmera.setAuthorizedAdvertisingIdentifier(true)
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
[Netmera setAuthorizedAdvertisingIdentifier:YES];
```

{% endtab %}
{% endtabs %}

#### Checking Ad\_ID Authorization Status

To check the current authorization status of the Ad\_ID, use the following method. This method returns a boolean value indicating whether the app has been authorized for Ad\_ID usage.

{% tabs %}
{% tab title="Swift" %}

```swift
Netmera.isAuthorizedAdvertisingIdentifier()
```

{% endtab %}

{% tab title="Objective-C" %}

```objectivec
BOOL isAuthorized = [Netmera isAuthorizedAdvertisingIdentifier];
```

{% endtab %}
{% endtabs %}

### User Details and Ad\_ID in Netmera Panel

You can view the Ad\_ID and its permission status under **Settings > User** in the Netmera Panel. The Ad\_ID and whether the user has granted permission to track are visible in the last two columns.

{% hint style="info" %}
**Troubleshooting Ad\_ID Panel Visibility**

If you cannot find the **Ad\_ID** options in the panel or encounter any issues, please reach out to the **Netmera Success Team** for assistance.
{% endhint %}

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FhYJzIAgHU5ibJTtfNiWb%2Funnamed.png?alt=media&#x26;token=0e7c2106-34ac-4b63-9bde-6c8399ee5720" alt="" width="563"><figcaption></figcaption></figure>

### Filtering Users Based on Ad\_ID Permission

You can filter users based on their Ad\_ID permission status within the **Targeting > People** section of the Netmera Panel. This enables you to create campaigns tailored specifically to users who have either granted or denied permission for ad tracking.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FttA2je7SwYgc83QqnmFo%2Fimage.png?alt=media&#x26;token=c9359076-e7c2-4c6f-aad2-2f4ff44e4cd1" alt="" width="284"><figcaption></figcaption></figure>

### Exporting Users Based on Ad\_ID Permission

* After filtering your audience in the **"Targeting > People"** section, use the **‘Find’** button to list users fitting your criteria.
* Click on **‘Target Users Found’** to export the filtered user list for further analysis or campaign targeting.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2F6yq8sFIyERcNnv47IjaC%2FScreenshot%202024-01-31%20at%2015.09.59.png?alt=media&#x26;token=8c3a6827-0a0e-45fe-b4bc-86ea11acccee" alt="" width="375"><figcaption></figcaption></figure>

### Targeting Based on Ad\_ID Permission

When creating a campaign in the **Netmera Panel**, specifically on **Step 3: Who**, you can select the **‘By Advertising ID’** option. This allows you to target users based on their Ad\_ID, providing a more personalized and effective strategy for user engagement.

<figure><img src="https://2578508252-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0bOAscrXzPSujyzq8DEz%2Fuploads%2FxpB0GfqHUOCcoCTgcvJa%2FScreenshot%202024-01-31%20at%2015.07.39.png?alt=media&#x26;token=5e59f0b6-7a4d-4f39-a98e-b9c3dd0c27c8" alt=""><figcaption></figcaption></figure>
