# Adobe Analytics with Datastreams

## Overview

The newly developed “alloy.js” library from Adobe is a JavaScript library that helps merchants measure how users interact with their website.

The new approach of the current “alloy.js” improves:

* Page performance by loading a smaller tracking library.
* Use of the same visitor identifier across different solutions from Adobe platform.
* On client-side data, it minimizes the transmissions from website to Adobe platform.

Implementing Adobe Analytics using the Adobe Experience Platform Web SDK (alloy.js) probably will charge fees, so be in touch with your Adobe provider. For more information on the Adobe Experience Platform Web SDK and how to install it, click <https://experienceleague.adobe.com/docs/analytics/implementation/aep-edge/web-sdk/overview.html?lang=en>.

## Setting the Adobe Analytics configuration

To implement Adobe Analytics on your website, follow these steps:

{% stepper %}
{% step %}

### Configure Adobe Analytics in the Merchant Control Panel

1. Log into your 2Checkout (now Verifone) Merchant Control Panel and navigate to **Setup**.
2. Select **Ordering Options**.
3. Click on the **Analytics** tab.
4. Click on the **Convert Plus & Inline Checkout** button.
5. In the *Adobe Analytics* panel click on **Setup**.

![setting adobe analytics](/files/ccea4c7894ab7a99adcb1f8b9191c8438aa83100) 6. Fill in the two fields. The information can be extracted from the datastream creation in the Adobe platform.

![Adobe Analytics Edge Configuration ID and Experience Cloud Organization ID](/files/b70622850612e43aa083d80311039f19096e243d)

The Adobe Analytics Edge Configuration ID and Experience Cloud Organization ID can be found in Adobe Experience Platform.

* The **Edge Configuration ID** means **Datastream ID** and represents the ID of the configuration that is set on the datastream created for transferring data to the Adobe Analytics module.
* The **Organization ID** means the ID that Adobe is creating for a user and helps the Adobe Platform to recognize the user between the changes from different module/applications.

![Adobe Experience Platform](/files/2eee9e517448b2145078b0633c3936f3a865fff2)

7. Click on the **Inactive** button to activate the configuration credentials for Adobe Analytics.

![Activate button](/files/8d7ae18b1d075e25f70c3a6058d1755654f794fe)
{% endstep %}
{% endstepper %}

## Setting the Adobe Experience Platform for using Adobe Analytics

To implement a report in Adobe Analytics from the data sent in the shopping cart, first you need to create a datastream and a schema to set the logic data into the datastream.

{% stepper %}
{% step %}

### Create a schema in Adobe Experience Platform

1. Go to **Adobe Experience Platform** and click on the **Schemas** option from the left side panel. Then, click on the **Create schema** button. This schema should use the XDM Adobe pre-built schemas for the data to be recognized in the Adobe Analytics report.

The **XDM ExperienceEvent** is used as the primary selection for the Adobe pre-built class because this is how Adobe Analytics service can recognize the schema in the datastream.

![XDM ExperienceEvent](/files/71616c5dbde7e831022a39c7b2159b175918918d) 2. In the new schema, go to **Schema properties** and enter the **Display name** and **Description**. In the left-side panel, go to the **Fields group** and click on **Add**; this will open the pre-built schema for Adobe Analytics to be selected.

![New schema settings](/files/1d6655447220853ca3c6314827b8503fcd65c580)

This step is important as here you get the data that will be mapped in the datastream with the data sent from the shopping cart.

![Add fields group](/files/56625c93ca851a8c1155ace077e53eee26522d48)
{% endstep %}

{% step %}

### Create a datastream

3. After saving the schema, go back to the **Datastreams** section, and create a **New Datastream**, selecting the already created schema from the *Event schema* drop-down option.

![Datastreams section](/files/83917126ae11e8fe19655e4e7654e5ffebfc1850)

The steps on how to map the data will be treated in the section Mapping the data to Adobe Analytic context.

All of these steps can be reproduced in the Adobe Experience Platform Data Collection module from the same Adobe Experience Cloud environment.

![Adobe Experience Platform Data Collection](https://verifone.cloud/sites/default/files/inline-images/11_0.JPG)
{% endstep %}
{% endstepper %}

## Mapping the data to Adobe Analytics context

For mapping the correct data into the Adobe Analytics module, 2Checkout provides the schema that is sent from the shopping cart. For mapping the data, you need to know two aspects: the data that is sent from 2Checkout, and the data recognized (or created as new evar/events) in the Adobe Experience Platform.

Data sent from 2Checkout

A general overview of this data is presented in the code snippet below:

{% code title="example.json" %}

```json
{
  "event": "checkout",
  "ecommerce": {
    "currencyCode": "string required",
    "sessionId": "string required",
    "checkout": {
      "actionField": {"<< ActionField object >>"},
      "products": ["<< List of product object >>"]
    },
    "purchase": {
      "actionField": {"<< ActionField object >>"}
    },
    "products": ["<< List of product object >>"],
    "add": {
      "products": ["<< List of product object >>"]
    },
    "remove": {
      "products": ["<< List of product object >>"]
    },
    "impressions": ["<< List of impression object >>"]
  },
  "PAGE_NAME": "string => string",
  "VENDOR_CODE": "string => string",
  "ONESTEPCART": "true => bool",
  "SHORT_FORM": "true => bool",
  "PURCHASE_COMPLETE": "bool",
  "TEST_ORDER": "bool => bool",
  "PRODUCT_SOURCE": "string",
  "CART_LOCK": "bool => bool",
  "DISCOUNT_COUPON_STATUS": "string",
  "AUTO_RENEWAL": "string => string",
  "PURCHASE_TYPE": "string => string",
  "LANGUAGE": "string => string",
  "BILLING_COUNTRY": "string",
  "VISITOR_COUNTRY": "string",
  "BILLING_CURRENCY": "string",
  "COMPANY_NAME": "string",
  "ORDER_EXT_REF": "string",
  "CUSTOMER_EXT_REF": "string",
  "TEMPLATE_LAST_MODIFIED_DATE": "string",
  "TEMPLATE_CREATION_DATE": "string",
  "PAGE_STYLE_NAME": "string",
  "ADDITIONAL_HIDDEN_FIELDS": "array",
  "SELLER_TYPE": "string",
  "PAYMENT_METHOD": "string",
  "PAYMENT_METHOD_TYPE": "string",
  "QUANTITY_CHANGED": "string",
  "CART_STEP": "string",
  "ADDITIONAL_FIELDS_COUNT": "number",
  "SOURCE": "string",
  "PURCHASE_FLOW": "string",
  "CREDIT_CARD_INSTALLMENTS": "string",
  "LEAD_MANAGEMENT": "string",
  "PAYMENT_CATEGORY": "string",
  "time": "number"
}
```

{% endcode %}

In the next tables, each event is described in detail:

Object ecommerce (key "ecommerce" on the event name "checkout")

| Key                 | Content                                                                                                             |
| ------------------- | ------------------------------------------------------------------------------------------------------------------- |
| currencyCode        | String (required) — The currency code                                                                               |
| sessionId           | String (required) — The session ID                                                                                  |
| checkout            | Object (required) — The object that will implement the checkout event. Will have two keys: actionField and products |
| actionField         | Object (required)                                                                                                   |
| products            | Array of objects (required)                                                                                         |
| coupon              | String — If there is a promotion, a coupon will be needed                                                           |
| orderDiscountCoupon | String — The discount from the added coupon                                                                         |

Object actionField (key “actionField” on the event name “checkout”)

| Key                   | Content                                   |
| --------------------- | ----------------------------------------- |
| step                  | Integer (required) — The step             |
| checkout\_revenue     | String (required) — Checkout revenue      |
| checkout\_revenueUSD  | String (required) — Checkout revenue USD  |
| checkout\_tax         | String (required) — Checkout tax          |
| checkout\_taxUSD      | String (required) — Checkout tax USD      |
| checkout\_shipping    | String (required) — Checkout shipping     |
| checkout\_shippingUSD | String (required) — Checkout shipping USD |

Object product (key “products”, array of product)

| Key                    | Content                                                                                          |
| ---------------------- | ------------------------------------------------------------------------------------------------ |
| name                   | String (required) — The name of the product                                                      |
| id                     | String (required) — The ID of the product                                                        |
| price                  | String (required) — The price                                                                    |
| discountAmount         | String (required) — The amount of the discount                                                   |
| quantity               | Number (required) — The quantity                                                                 |
| type                   | String (required) — The type of the product                                                      |
| group                  | String (required) — The group                                                                    |
| tax                    | Number (required) — The tax amount                                                               |
| format                 | String (required) — The format                                                                   |
| coupon                 | String — If there is a promotion, a coupon will be needed                                        |
| discountCoupon         | String — The discount from the added coupon                                                      |
| itemExtRef             | String — The product external reference                                                          |
| isDynamic              | Boolean — The product is dynamic                                                                 |
| dynamicType            | String — The type of dynamic product                                                             |
| dynamicRecurrence      | String — The recurrence of dynamic product                                                       |
| dynamicDuration        | Number — The duration of a dynamic product                                                       |
| dynamicRenewalPrice    | Number — The renewal price for a dynamic product                                                 |
| options                | Array of strings — Extra option for the product                                                  |
| hiddenAdditionalFields | Array of strings — Additional hidden fields set by the merchant in the Control Panel application |

Object ecommerce (key “ecommerce” on the event name “purchase”)

| Key            | Content                                                                                               |
| -------------- | ----------------------------------------------------------------------------------------------------- |
| currencyCode   | String (required) — The currency code                                                                 |
| sessionId      | String (required) — The session ID                                                                    |
| purchase       | Object (required) — The object that will implement the purchase event; will have one key: actionField |
| actionField    | Object (required)                                                                                     |
| orderTimestamp | String (required) — The timestamp of the place order                                                  |
| products       | Array of objects (required) — The product object                                                      |

Event name “cartUpdate”

| Key                            | Content                                                                                          |
| ------------------------------ | ------------------------------------------------------------------------------------------------ |
| PAGE\_NAME                     | String — The name of the page                                                                    |
| VENDOR\_CODE                   | String — Vendor code                                                                             |
| ONESTEPCART                    | Boolean — One step cart value                                                                    |
| SHORT\_FORM                    | Boolean — Short form value                                                                       |
| PURCHASE\_COMPLETE             | Boolean — The purchase is completed                                                              |
| TEST\_ORDER                    | Boolean — The order is for testing purpose                                                       |
| PRODUCT\_SOURCE                | String — The product source                                                                      |
| CART\_LOCK                     | Boolean — The cart is locked                                                                     |
| DISCOUNT\_COUPON\_STATUS       | String — The status for the discount coupon                                                      |
| AUTO\_RENEWAL                  | String — Auto renewal value                                                                      |
| PURCHASE\_TYPE                 | String — The type of the purchase                                                                |
| LANGUAGE                       | String — The language code                                                                       |
| BILLING\_COUNTRY               | String — The billing country                                                                     |
| VISITOR\_COUNTRY               | String — The visitor country                                                                     |
| BILLING\_CURRENCY              | String — The billing currency                                                                    |
| COMPANY\_NAME                  | String — The company name                                                                        |
| ORDER\_EXT\_REF                | String — The order external reference                                                            |
| CUSTOMER\_EXT\_REF             | String — The customer external reference value                                                   |
| TEMPLATE\_LAST\_MODIFIED\_DATE | String — Template last modified date                                                             |
| TEMPLATE\_CREATION\_DATE       | String — Template creation date                                                                  |
| PROFESSIONAL\_SERVICES         | String — Professional services value                                                             |
| PAGE\_STYLE\_NAME              | String — Page style name                                                                         |
| ADDITIONAL\_HIDDEN\_FIELDS     | Array of strings — Additional hidden fields set by the merchant in the Control Panel application |
| SELLER\_TYPE                   | String — Seller type value                                                                       |
| PAYMENT\_METHOD                | String — Payment method value                                                                    |
| PAYMENT\_METHOD\_TYPE          | String — Payment method type value                                                               |
| QUANTITY\_CHANGED              | Number — The new quantity of the cart updated event                                              |
| CART\_STEP                     | String — The step of the cart                                                                    |
| ADDITIONAL\_FIELDS\_COUNT      | Number — The count of the additional fields                                                      |
| SOURCE                         | String — The source value                                                                        |
| PURCHASE\_FLOW                 | String — The purchase flow value                                                                 |
| CREDIT\_CARD\_INSTALLMENTS     | String — The credit card installments                                                            |
| LEAD\_MANAGEMENT               | String — The lead management value                                                               |
| PAYMENT\_CATEGORY              | String — The payment category                                                                    |
| time                           | Number — The timestamp on which the event is created                                             |
| REVIEW\_FLOW                   | String — The review flow value                                                                   |

Event name “addToCart”

| Key          | Content                                                               |
| ------------ | --------------------------------------------------------------------- |
| currencyCode | String (required) — The currency code value                           |
| ecommerce    | Object (required) — Ecommerce object that will have a key named “add” |
| add          | Object (required) — contains `products`                               |
| products     | Array of objects (required) — The product object                      |

Event name “removeFromCart”

| Key                 | Content                                                   |
| ------------------- | --------------------------------------------------------- |
| ecommerce           | Object (required) — Ecommerce object                      |
| currencyCode        | String (required) — The currency code value               |
| sessionId           | String (required) — The session ID value                  |
| remove              | Object (required) — contains `products`                   |
| products            | Array of objects (required) — The product object          |
| coupon              | String — If there is a promotion, a coupon will be needed |
| orderDiscountCoupon | String — The discount from the added coupon               |

Event name “productImpression”

| Key         | Content                                                                       |
| ----------- | ----------------------------------------------------------------------------- |
| ecommerce   | Object (required) — Ecommerce object that will have a key named `impressions` |
| impressions | Array of objects (required) — The impression object                           |

Object impression (key “impressions”, array of impression)

| Key                    | Content                                                                                 |
| ---------------------- | --------------------------------------------------------------------------------------- |
| name                   | String (required) — The name of the product                                             |
| id                     | String (required) — The ID of the product                                               |
| price                  | String (required) — The price                                                           |
| discountAmount         | String — The amount of the discount                                                     |
| type                   | String — The type of the product                                                        |
| group                  | String (required) — The group value                                                     |
| format                 | String (required) — The format                                                          |
| isDynamic              | Boolean — The product is dynamic                                                        |
| dynamicType            | String — The type of dynamic product                                                    |
| hiddenAdditionalFields | Array of strings — Additional hidden fields set by the vendor in the cPanel application |
| position               | Number — The position of the impression                                                 |

## Data needed from Adobe Experience Platform

Go back to the new created datastream from Adobe Platform, and click on the **Edit Mapping** section.

![Edit mapping](/files/db0799525bf99bc4d0ff1d379243c35a9c87e937)

Here is an example of a partial mapped scheme:

![Example of a partial mapped scheme](/files/ab1671c27c14b723a17ebd3f324e5ba325fb6171)

## How to create Events and Variables in the Adobe Analytics application

{% stepper %}
{% step %}

### Access Report Suites

1. Log into **Adobe Analytics**.
2. Go to **Admin** > **Report Suites**.

![Report suites option](/files/69daeaea311f721e6b487451573f07a8e467c331)

3. Click on the Report suites for which you want to build variables or events.

![report suites list](/files/d70dd8ada224628d6a4df13e8cda2175bc1d47f5)
{% endstep %}

{% step %}

### Example: Build a custom event in Adobe Analytics

* Click on **Edit Settings** > **Conversion** > **Success Events** to build custom events.

![Report Suite manager](/files/ab1cc29a6aafdd269a37cfff1d7d9ae76a821a33)

* Click on **Add New** and then define the new event, for example event10: write a name for the event (ex: “Product Discount Value”).
* Under the **Type** column, select **Currency** if a monetary value is sent under this event. Leave other fields as preselected by Adobe in this example.

![currency settings](/files/0c3b17d5257e3d49e276dee9c8196e9e2c06d1b1)

* Click the **Save** button at the bottom of the page.

![Save option](/files/22fb473d3267aa1a1360c8671523ba11f4ebdf75)

* After the event was created, it will appear in Adobe Analytics Workspaces. Search for “event10” in the left-side panel.

!["event10" example](/files/35b27cafdfb142c353786856fcfc990c4f7106ef)
{% endstep %}

{% step %}

### Example: Build a custom variable in Adobe Analytics

A. Session level variable – example evar8 Order ID

* Click on **Edit Settings** > **Conversion** > **Conversion Variables** to build custom variables.

![Session level variable - Conversion Variables example](/files/0a8c0375a7d00a90abfaad650b9d259cfadeb4eb)

* Click on **Add New** and define the new variable, for example evar8, add as name *Order ID*. Select **Linear** as allocation for order ID.

![Add new Session level variable - Conversion Variables example](/files/5c9c8dedb065fb8211909da316ba755d71a1fe47)

* Click **Save** at the bottom of the page.
* After the evar was created, it will appear in **Adobe Analytics Workspaces**; search for evar8 in the left-side panel.

![Created evar - Session level variable example](/files/37e8668e468fd0e96443705e6ab4838e5b77ae41)

B. Merchandising variable – example evar26 Product Discount Coupon Value

* Click **Add New** and define the new variable with Product Name “Product Discount Coupon Value”.
* Click **Enable merchandising** (applicable for merchandising evars — evars that send information specific for certain products, e.g., certain products in an order can have different coupon discounts).
* For Merchandising click **Product Syntax** from the drop-down list and set *Allocation* to **Most Recent (Last)**.

![Adding new Merchandising variable example](/files/7d96cb575f5b7781d8a8630f07f1f4b151438bb5)

* Click **Save** at the bottom of the page.
* After the evar was created, it will appear in **Adobe Analytics Workspaces**; search for evar26 in the left-side panel.

![Merchandising variable evar created](/files/e53d2f164ac7f80161548322e684cf430bbf7659)
{% endstep %}
{% endstepper %}


---

# 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://docs.2checkout.com/analytics/analytics/adobe-analytics-with-datastreams.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.
