# Push data to JENTIS

{% hint style="warning" %}
**Before you start**, the JENTIS App SDK uses the same approach as the web data layer. We recommend reading the [set-up-jentis-data-layer](https://docs.jentis.com/data-capture/web-tracking-setup/set-up-jentis-data-layer "mention")article to better understand this documentation.
{% endhint %}

This article explains how to push data from your app to JENTIS using the App SDK. Expertise in app development will be needed for this.

## General

In the JENTIS App SDK, we follow a push call stack approach. When the `submit()` function is called, the necessary information is included in the Data Submission Request sent to JENTIS, and the JENTIS SDK call stack is reset.

## Track Push Events

### iOS Implementation:

Track custom events with the `push` method. Events will be stored but not sent to the server:

```swift
TrackingService.shared.push([
    "track": "pageview",
    "title": "Home Page",
    "url": "https://example.com"
])
```

### Android Implementation:

To track custom events, use the `addToPush` method. Events will be stored locally and not sent to the server until the submission method is called:

```kotlin
JentisTrackService.getInstance().push()
```

## Submitting Data

When the `submit` function is called in the mobile environment, the data is transmitted to JENTIS and flagged with the status **'JENTIS Datalayer SENT'**, indicating successful submission.

### iOS Implementation:

To submit stored events, you need to call the `submit` method. All events will be sent to the server and the local and deleted from the local queue:

```swift
try await TrackingService.shared.submit()
```

### Android Implementation:

To submit stored events, you need to call the `submitPushing` method. All events will be sent to the server and the local and deleted from the local queue:

```kotlin
JentisTrackService.getInstance().submit()
```

## Default Tracking

This data is added by default to every request by the JENTIS App SDK when the `submit()` function is executed.

### iOS Implementation:

| Key                             | Description                                                                   | Example Value(s)                                                                                               |
| ------------------------------- | ----------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- |
| app\_device\_id                 | Unique device identifier UUID of the device                                   | A1B2C3D4-5678-90AB-CDEF-1234567890AB                                                                           |
| app\_device\_brand              | The brand of the device                                                       | Apple                                                                                                          |
| app\_device\_model              | The device model                                                              | iPhone14,5 (for iPhone 13, see [Lookup table](https://gist.github.com/adamawolf/3048717) for more Information) |
| app\_device\_os                 | The device operating system                                                   | iOS                                                                                                            |
| app\_device\_os\_version        | The device OS version                                                         | 15.0, 13.1                                                                                                     |
| app\_device\_language           | The device language                                                           | de, en                                                                                                         |
| app\_device\_region             | The device region specified in the device settings (not the current location) | US                                                                                                             |
| app\_device\_width              | The screen width of the device                                                | 390                                                                                                            |
| app\_device\_height             | The screen height of the device                                               | 844                                                                                                            |
| app\_device\_carrier            | The network carrier name of the device                                        | Verizon, AT\&T                                                                                                 |
| app\_device\_network\_type      | The type of network connection                                                | Wi-Fi, Cellular                                                                                                |
| app\_application\_name          | The name of the application                                                   | ExampleApp                                                                                                     |
| app\_application\_version       | The app version                                                               | 1.0, 2.1                                                                                                       |
| app\_application\_build\_number | The app build number                                                          | 1, 2, 3                                                                                                        |

### Android Implementation:

| Key                             | Description                                 | Example Value(s)                     |
| ------------------------------- | ------------------------------------------- | ------------------------------------ |
| app\_device\_id                 | Unique device identifier UUID of the device | A1B2C3D4-5678-90AB-CDEF-1234567890AB |
| app\_device\_brand              | The brand of the device                     | Samsung                              |
| app\_device\_model              | The device model                            | Galaxy S21                           |
| app\_device\_os                 | The device operating system                 | Android                              |
| app\_device\_os\_version        | The device OS version                       | 12, 11                               |
| app\_device\_language           | The device language                         | en                                   |
| app\_device\_region             | US                                          |                                      |
| app\_device\_width              | The screen width of the device              | 1080                                 |
| app\_device\_height             | The screen height of the device             | 2340                                 |
| app\_device\_carrier            | The network carrier name of the device      | Verizon, AT\&T                       |
| app\_device\_network\_type      | The type of network connection              | Wi-Fi, Cellular                      |
| app\_application\_name          | The name of the application                 | JentisAppExample                     |
| app\_application\_version       | The app version                             | 1.0.12                               |
| app\_application\_build\_number | The app build number                        | 1                                    |

## Tracking Examples

### iOS Pageview:

```swift
TrackingService.shared.push([
    "track": "pageview",
    "pagetitle": "Demo-APP Pagetitle",
    "url": "https://www.demoapp.com"
])

TrackingService.shared.submit()
```

### Android Pageview:

```kotlin
val pageViewData = listOf(
  mapOf(
    "track" to "pageview",
    "url" to "https://www.demoapp.com",#
    "title" to "Demo-APP Pagetitle"
  )
)

JentisTrackService.getInstance().push(pageViewData)
```

### iOS Productview:

```swift
TrackingService.shared.push([
    "track": "pageview",
    "pagetitle": "Demo-APP Productview"
])

TrackingService.shared.push([
    "track": "product",
    "type": "productview",
    "id": "123",
    "name": "Testproduct",
    "brutto": 199.99
])

TrackingService.shared.push([
    "track": "productview"
])

TrackingService.shared.submit()
```

### Android Productview:

```kotlin
JentisTrackService.getInstance().push(mapOf(
    "track" to "pageview",
    "pagetitle" to "Demo-APP Productview"
))

JentisTrackService.getInstance().push(mapOf(
    "track" to "product",
    "type" to "productview",
    "id" to "123",
    "name" to "Testproduct",
    "brutto" to 199.99
))

JentisTrackService.getInstance().push(mapOf(
    "track" to "productview"
))

JentisTrackService.getInstance().submit()
```

### iOS Add-to-Cart:

```swift
TrackingService.shared.push([
    "track": "product",
    "type": "addtocart",
    "id": "123",
    "name": "Testproduct",
    "brutto": 199.99
])

TrackingService.shared.push([
    "track": "addtocart"
])

TrackingService.shared.submit()
```

### Android Add-to-Cart:

```kotlin
JentisTrackService.getInstance().push(mapOf(
    "track" to "product",
    "type" to "addtocart",
    "id" to "123",
    "name" to "Testproduct",
    "brutto" to 199.99
))

JentisTrackService.getInstance().push(mapOf(
    "track" to "addtocart"
))

JentisTrackService.getInstance().submit()
```

### iOS Order / Purchase:

```swift
TrackingService.shared.push([
    "track": "pageview",
    "pagetitle": "Demo-APP Order Confirmed"
])

TrackingService.shared.push([
    "track": "product",
    "type": "order",
    "id": "123",
    "name": "Testproduct",
    "brutto": 199.99
])

TrackingService.shared.push([
    "track": "product",
    "type": "order",
    "id": "456",
    "name": "Testproduct 2",
    "brutto": 299.99
])

TrackingService.shared.push([
    "track": "order",
    "orderid": "12345666",
    "brutto": 499.98,
    "paytype": "creditcard"
])

TrackingService.shared.submit()
```

### Android Order / Purchase:

```kotlin
JentisTrackService.getInstance().push(mapOf(
    "track" to "pageview",
    "pagetitle" to "Demo-APP Order Confirmed"
))

JentisTrackService.getInstance().push(mapOf(
    "track" to "product",
    "type" to "order",
    "id" to "123",
    "name" to "Testproduct",
    "brutto" to 199.99
))

JentisTrackService.getInstance().push(mapOf(
    "track" to "product",
    "type" to "order",
    "id" to "456",
    "name" to "Testproduct 2",
    "brutto" to 299.99
))

JentisTrackService.getInstance().push(mapOf(
    "track" to "order",
    "orderid" to "12345666",
    "brutto" to 499.98,
    "paytype" to "creditcart"
))

JentisTrackService.getInstance().submit()
```

### Android Custom Event - complete registration:

```kotlin
JentisTrackService.getInstance().push(mapOf(
    "track" to "complete-registration",
    "registration_method" to "email"
))

JentisTrackService.getInstance().submit()
```

### iOS Custom Event - complete registration:

```swift
TrackingService.shared.push([
    "track": "complete-registration"",
    "registration_method": "email"
])

TrackingService.shared.submit()
```
