# Data Connections

Connect AdaptiveCX to your existing tools and data sources. Export specific data elements to external platforms and custom systems.

<figure><img src="https://2350286830-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6Yw9IRJ6KbbucQPwZUCZ%2Fuploads%2Fx2QiVCzh48pHjwDPcQ5T%2Fimage.png?alt=media&#x26;token=419323be-29bf-45bd-b7c9-e44309702ed8" alt=""><figcaption></figcaption></figure>

## What data connections do <a href="#what-data-connections-do" id="what-data-connections-do"></a>

Data connections export specific AdaptiveCX data to external platforms:

* **Audiences** - Send audience membership to marketing platforms
* **Predictions** - Export prediction scores to CDPs
* **Events** - Stream event data to analytics tools
* **Affinities** - Share interest scores with personalization engines
* **Attributes** - Sync visitor data to CRM systems

## Available data elements <a href="#available-data-elements" id="available-data-elements"></a>

When creating an integration, select which data to export:

* **Attribute Categories** - Custom attribute groups
* **Predictions** - Prediction scores for visitors
* **Audiences** - Audience membership data
* **Events** - Tracked events and their parameters
* **Affinities** - Visitor affinity scores
* **Attributes** - Visitor attribute values

## Create a data connection <a href="#create-a-data-connection" id="create-a-data-connection"></a>

{% stepper %}
{% step %}

### **Open Data Connections**

Go to `Activate` > `Integrations` > `Data Connections`.
{% endstep %}

{% step %}

### **Click Create New Integration**

The integration configuration modal opens.

<figure><img src="https://2350286830-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6Yw9IRJ6KbbucQPwZUCZ%2Fuploads%2Fjs3UOKJhlfset3gHaHi8%2Fimage.png?alt=media&#x26;token=0c559a8e-a4f5-400e-af21-98c756eb3d20" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### **Select Data Element Type**

<figure><img src="https://2350286830-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6Yw9IRJ6KbbucQPwZUCZ%2Fuploads%2FncNGOsACSf2YzCLfUZpf%2Fimage.png?alt=media&#x26;token=47649a8b-a138-4fa8-bbb6-7f048f63e71c" alt=""><figcaption></figcaption></figure>

Choose which data to integrate:

* Attribute Categories
* Predictions
* Audiences
* Events
* Affinities
* Attributes

Then select the specific data element from the list.&#x20;
{% endstep %}

{% step %}

### &#x20;**Choose Where to Store**

Select the destination for your data:

* External platform
* Custom endpoint
* Data warehouse

Configure the connection details for your destination.
{% endstep %}

{% step %}

### **Enter Key Name**

Provide a key name under which the data will be stored in the external system.

This key identifies the data in your destination system.
{% endstep %}

{% step %}

### **Create Integration**

Click **Create Integration** to activate the connection.&#x20;
{% endstep %}
{% endstepper %}

## Custom JS Code <a href="#custom-js-code" id="custom-js-code"></a>

Add custom JavaScript to trigger adaptive functionality on your site.

### When to use custom code <a href="#when-to-use-custom-code" id="when-to-use-custom-code"></a>

* Integrate with unsupported platforms
* Add custom event handling
* Implement complex personalization logic
* Connect to proprietary systems

### Create custom code <a href="#create-custom-code" id="create-custom-code"></a>

### &#xD; <a href="#create-custom-code" id="create-custom-code"></a>

{% stepper %}
{% step %}

#### Open Custom JS Code

In Data Connections, find the Custom JS Code section and click Create New Custom Code.

<figure><img src="https://2350286830-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6Yw9IRJ6KbbucQPwZUCZ%2Fuploads%2FuDHi4u0hqnBkLzSQN6E4%2Fimage.png?alt=media&#x26;token=8a5e79b4-f877-40e1-89c2-33c474ec321b" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### Enter name

Provide a descriptive name for your custom code in the Name field.
{% endstep %}

{% step %}

#### Configure targeting (Who To Target)

Set who should execute this custom code:

* Traffic Source: Target visitors from specific traffic sources
* Device: Target by device type (mobile, desktop, tablet)
* Audience: Target specific audiences

Click **Edit** to configure targeting rules.
{% endstep %}

{% step %}

#### Set when to run (When to Run)

Configure the execution frequency: how often the code runs (e.g., every session, once per visitor)
{% endstep %}

{% step %}

#### Write your JavaScript

In the **Your Custom Code** section, add your JavaScript code.

Use AdaptiveCX APIs within your code to:

* Get prediction scores
* Retrieve visitor attributes
* Check audience membership
* Trigger adaptive features
  {% endstep %}

{% step %}

#### Validate the code

Click **Validate Your JS Code** to check for syntax errors.
{% endstep %}

{% step %}

#### Publish

Click **Publish Code** to activate the custom code on your site.
{% endstep %}
{% endstepper %}
