> For the complete documentation index, see [llms.txt](https://docs.abtasty.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.abtasty.com/client-side/data-apis/universal-collect/uc-understanding-the-basics.md).

# Understanding the basics

{% hint style="warning" %}
Read me! This page is crucial to follow and understand if you're planning on sending data to AB Tasty using our **REST API**.\
If your goal is to implement custom trackings using our **JavaScript tag**, you can directly jump to the [Hits list](/client-side/data-apis/universal-collect/uc-hits.md) documentation.\
But you can also keep on reading for your curiosity and to understand how we are collecting the data :)
{% endhint %}

Universal Datacollect aims at providing a unified hit format which can be used to send data to AB Tasty using any programming languages, client-side and server-side.

### Identifying yourself

Each time you will send data to AB Tasty, you will need to identify yourself with your unique *identifer*. For client-side users, you can find your unique identifer in your AB Tasty settings, in the tag snippet.

```
Example of AB Tasty identifier: 3d09baddc21a365b7da5ae4d0aa5cb95
```

### Identifying your visitors

#### Visitor ID

Each visitor needs a unique ID we can refer to. The visitorId is a hash composed of [16 alphanumeric characters](https://en.wikipedia.org/wiki/Base32#Crockford's_Base32).

`xst8a1w2a2630rtc`

{% hint style="info" %}
We used to generate a 17 digits ID in the past, you might still encounter one!
{% endhint %}

#### Sessions

At AB Tasty, we consider a 'session' to be a navigation that doesn't go over 30 minutes of inactivity. We control the Time To Live of this session in a cookie `ABTastySession`.

{% hint style="info" %}
All sessions reset at midnight depending on the timezone set on your account.
{% endhint %}

### Identifying the campaigns

#### IDs terminology

Every AB Tasty campaign is identified by a 6 digits ID. The same goes for every AB Tasty variations that are part of a campaign. Personnalisations, Multipages and MVTs are composed of a master campaign (and master ID) with sub-campaigns (referred as *sub-segments*) and sub-campaigns ID.

To clarify the ID system used, here's a tab with examples:

| Type | CampaignId | SubcampaignId | VariationId    | Subcampaign variationId |
| ---- | ---------- | ------------- | -------------- | ----------------------- |
| A/B  | 435523     | none          | 645234, 645235 | none                    |

> An A/B only has one campaignId and as many variationId as created.

| Type | CampaignId | SubcampaignId  | VariationId | Subcampaign variationId        |
| ---- | ---------- | -------------- | ----------- | ------------------------------ |
| MP   | 352643     | 546738, 645324 | none        | 756523, 756524, 756525, 756526 |

> A Multipage has no variationId on its own, however its subcampaigns has as many variationId as created (in this example: two each).\
> A visitor exposed to variation A of subcampaign 1 will see variation A of subcampaign 2.

| Type  | CampaignId | SubcampaignId  | VariationId | Subcampaign variationId |
| ----- | ---------- | -------------- | ----------- | ----------------------- |
| Perso | 358574     | 544635, 646352 | none        | 647843, 647844          |

> A Personnalization has no variationId on its own, but each subcampaign (referred as *scenarios* for persos) has one.

| Type | CampaignId | SubcampaignId          | VariationId | Subcampaign variationId |
| ---- | ---------- | ---------------------- | ----------- | ----------------------- |
| MVT  | 352643     | 546738, 645324, 645328 | none        | 756523, 756524          |

> A MVT works exactly as a MP, but a visitor is randomly exposed to any variationID accross the subcampaigns.

{% hint style="warning" %}
Campaign and variation IDs often follow each other since they are most of time created at the same moment. However, that's not a general rule.
{% endhint %}

#### Campaign history

Each time a visitor is exposed to a campaign we add it to his *campaign history*. A campaign stays in the visitor campaign history for 30 days after the last exposure for attribution purpose. A missing campaign history is reconstructed based on the info we already have on the visitor during the data ingestion.

When an event is fired (click, transaction, pageview), it is linked to every campaign that composes its campaign history.

The campaign history is composed of a list of campaignId / variationId pairs.

> Example of campaign history

```
{
    "123456":"654321",
    "789123":"123789",
    "567123":"123567"
}
```

### Arguments

#### Common arguments

For each type of hit you want to send to our collect API, you will have to fill arguments.\
Most hits share the same list of **mandatory** common arguments.\
Our JavaScript tags take care of the common arguments for you, you only have to implement the specific arguments for each hit type.

You will find the full list of arguments in the [Common arguments](/client-side/data-apis/universal-collect/uc-common-arguments.md).

#### Specific arguments

Each type of hits as its own set of specific arguments that will provide information about specific user action.

See the [Hits list](/client-side/data-apis/universal-collect/uc-hits.md) for more information.

### Type of hits

The data you send to AB Tasty is grouped by type of hits. A hit isn't processed the same way depending on its nature and will serve several tools, services and purposes in the AB Tasty platform. Our JS tag covered most common hits while you will have to implement any others custom hits: clicks, transactions, form filling, etc.

#### List of hits type

You can find the documentation for all hits types [Hits list](/client-side/data-apis/universal-collect/uc-hits.md).

<table><thead><tr><th width="202.8671875">name</th><th width="378.05859375">purpose</th><th>handled by the tag</th></tr></thead><tbody><tr><td>CAMPAIGN</td><td>Sent each time a visitor is exposed to a campaign</td><td>yes</td></tr><tr><td>PAGEVIEW</td><td>Sent each time a visitor sees a page (web only)</td><td>yes</td></tr><tr><td>SCREENVIEW</td><td>Sent each time a visitor sees a page (app only)</td><td>yes</td></tr><tr><td>VISITOREVENT</td><td>Sent each time a listed type of user interaction is registered: click, scroll, hover, ...</td><td>yes</td></tr><tr><td>PERFORMANCE</td><td>Occasionally sent to remotely monitor the performance of our tag (sampled)</td><td>yes</td></tr><tr><td>DATALAYER</td><td>Sent when the feature that collects the datalayer infos is enabled</td><td>yes</td></tr><tr><td>BATCH</td><td>Rootbase hit for the batching system. <a data-mention href="/pages/aLeRdUcK3TTHSFxfSiIC">/pages/aLeRdUcK3TTHSFxfSiIC</a></td><td>yes</td></tr><tr><td>EVENT</td><td>Send an event following category / action / label / value pattern</td><td>yes*</td></tr><tr><td>TRANSACTION</td><td>Send a transaction (also refers to the <a data-mention href="https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/data/universal-collect/broken-reference/README.md">https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/data/universal-collect/broken-reference/README.md</a>)</td><td>no</td></tr><tr><td>ITEM</td><td>Send an item attached to a transaction (also refers to the <a data-mention href="https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/data/universal-collect/broken-reference/README.md">https://gitlab.com/abtasty/team/product-management/gitbook-documentation/-/blob/main/developers-doc/data/universal-collect/broken-reference/README.md</a>)</td><td>no</td></tr><tr><td>SEGMENT</td><td>Collect data about a specific visitor for further targeting purpose of data filtering</td><td>no</td></tr><tr><td>NPS</td><td>Used by the NPS widget. However, you can build your own NPS and fill our NPS report using this hit</td><td>no</td></tr></tbody></table>

\* only events created in the editor

### Frequently Asked Questions

#### What is the maximum events per session?

It is currently set to 2000 events.

#### When does the session get closed?

After 30 minutes of inactivity (no new hits) or at midnight depending on your account's timezone.

#### What is the maximum size of a hit?

The size limit of a hit is set to 5 MB, indepently from the limit of each parameter itself.

#### About timezones

Through our APIs, you could find three format when it comes to dates:

* timestamp (**integer**), necessarly UTC. eg `1676989445`
* String with specified timezone. eg `2023-01-17 14:01:39 UTC+1`
* raw integer. eg `Hour=17` in Data Explorer. This follow your account's timezone set in your account settings and is on the 24hr format.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.abtasty.com/client-side/data-apis/universal-collect/uc-understanding-the-basics.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
