# Track consent and GDPR with the native mobile trackers
> Add GDPR consent context entities to all tracked events for legal compliance and privacy management.
> Source: https://docs.snowplow.io/docs/sources/mobile-trackers/tracking-events/gdpr-tracking/
> Documentation index: https://docs.snowplow.io/llms.txt

You can add an [entity](https://github.com/snowplow/iglu-central/blob/master/schemas/com.snowplowanalytics.snowplow/gdpr/jsonschema/1-0-0) detailing the GDPR basis for processing to every event tracked. To configure this, provide a `GdprConfiguration` object when setting up a new tracker.

The only required argument is the `Basis` enum, which contains the six GDPR options. A document describing the legal basis for processing can also be provided (as a string), along with the document version and ID.

**iOS:**

```swift
let gdprConfig = GDPRConfiguration(
  basis: .consent, // basis for processing
  documentId: "id", // document ID
  documentVersion: "1.0", // document version
  documentDescription: "Legal justification" // document
)

let networkConfig = NetworkConfiguration(
  endpoint: "https://collector-url.com",
  method: .post
)

Snowplow.createTracker(
  namespace: "namespace",
  network: networkConfig,
  configurations: [gdprConfig]
)
```

**Android (Kotlin):**

```kotlin
val gdprConfiguration = GdprConfiguration(
    Basis.CONSENT, // basis for processing
    "someId", // document ID
    "0.1.0", // document version
    "Legal justification" // document
)

val networkConfiguration = NetworkConfiguration("https://collector-url.com")

createTracker(
    applicationContext,
    "namespace",
    networkConfiguration,
    gdprConfiguration
)
```

**Android (Java):**

```java
GdprConfiguration gdprConfiguration = new GdprConfiguration(
        Basis.CONSENT, // basis for processing
        "someId", // document ID
        "0.1.0", // document version
        "Legal justification" // document
);

NetworkConfiguration networkConfiguration = new NetworkConfiguration("https://collector-url.com");

Snowplow.createTracker(
        getApplicationContext(),
        "namespace",
        networkConfiguration,
        gdprConfiguration
);
```

***
