# \[Android]特別な扱いを受けるフィールド

フィールド名によっては、KARTE管理画面上で特別な扱いを受けるものや、接客サービスで特別な扱いを受けるものがあります。

## 管理画面上で特別な扱いを受けるフィールド

### 日付型フィールド

任意のイベントのフィールド名の末尾を `_date` （例：xxx\_date）とすることで、日付型のフィールドとして扱うことが可能になります。

日付型のフィールドとすることにより、日時（絶対・相対時間指定）を利用したセグメントの設定が容易になります。

なおフィールドの値には、`java.util.Date` 型の値を指定してください。

### 位置情報型フィールド

任意のイベントのフィールド名の末尾を `latlng`（例：latlng / xxx\_latlng）とすることで、位置情報型のフィールドとして扱うことが可能になります。

位置情報型のフィールドとすることにより、位置情報を利用したセグメントやトリガーの設定が容易になります。

なおフィールドの値には、経度・緯度を含む配列を指定してください。

{% hint style="danger" %}
**位置情報型フィールドの指定方法について**

配列の0番目には、`経度（longitude）` を、1番目には `緯度（latitude）` を、それぞれ数値で指定する必要があります。\
各要素を逆に指定した場合は、セグメントやトリガーが正常に機能しませんのでご注意ください。
{% endhint %}

{% tabs %}
{% tab title="Kotlin" %}
{% code overflow="wrap" %}

```kotlin
Tracker.track("current_location", mapOf(
  "latlng" to listOf(139.7649361, 35.6812362)
))
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code overflow="wrap" %}

```java
Map<String, Object> values = new HashMap<>();
values.put("latlng", Arrays.asList(139.7649361, 35.6812362));
Tracker.track("current_location", values);
```

{% endcode %}
{% endtab %}
{% endtabs %}

## 特定の接客サービスで必要となるフィールド

### 閲覧人数表示テンプレート

閲覧人数表示テンプレートを利用した接客サービスで、閲覧人数を表示するためには View イベントに `view_id` フィールドを追加する必要があります。

{% hint style="info" %}
**フィールドに指定する値について**

`view_id` の値には、画面（コンテンツ）を一意に識別するための文字列を指定してください。\
例えば、ECサイトの商品詳細画面の場合は、`view_id` に商品IDなどを設定することが一般的です。
{% endhint %}

{% tabs %}
{% tab title="Kotlin" %}
{% code overflow="wrap" %}

```kotlin
Tracker.view("item_detail", "商品詳細", mapOf(
  "view_id" to "P1234567890"
))
```

{% endcode %}
{% endtab %}

{% tab title="Java" %}
{% code overflow="wrap" %}

```java
Map<String, Object> values = new HashMap<>();
values.put("view_id", "P1234567890");
Tracker.view("item_detail", "商品詳細", values);
```

{% endcode %}
{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://app.developers.karte.io/android-sdk-appendix/appendix-special-fields-android-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
