# Migrate Existing Consent Database from Legacy Provider (/docs/consent-management/reference/migrate-consent)

## Overview [#overview]

Transcend allows you to save user consent across websites.

This piece of documentation describes steps to undertake in order to migrate consent preferences from an existing Privacy Provider to Transcend. Going through these steps in sequential order is needed, so that both systems are temporarily in place at the same time, and bridge over the migration period.

## Migration Steps [#migration-steps]

### 1. Install Airgap on Your Website [#1-install-airgap-on-your-website]

The steps required to install and configure airgap are included in your onboarding plan. General documentation can be found [here](../quickstart.mdx).

In order to migrate from a previously existing privacy provider, you will need to go through installation of airgap.js and [configure privacy regimes](../concepts/regime-detection.mdx).

airgap needs to be Live on your website before proceeding to the next steps, but `reporting-only` should be on as well, so that consent can be synced without any disruption for your users.

Customizing [Consent Experiences](../configuration/regional-experiences.mdx) and [triaging of Dataflows and Cookies](../configuration/triaging-and-telemetry/triage-cookies-and-dataflows-guide.mdx) can happen later. Just make sure to keep `reporting-only` on until right before the last step.

Please connect with your Transcend CX contacts if you need any assistance during that process.

### 2. Synchronize Your Existing Consent Manager With Transcend [#2-synchronize-your-existing-consent-manager-with-transcend]

The next step to migrate your Consent Management is to ensure that any future user consent updates are synchronized with Transcend.

The following approach will cover both logged in and anonymous users, and will sync whenever a page with airgap loads.

#### 2.1 Check Consent Status [#21-check-consent-status]

Upon page load, retrieve consent status from your legacy system, anonymous user cookie and/or your legacy consent provider, as well as Transcend, using `airgap.getConsent`. If airgap was already used by this user to update consent, this function will return consent information with `confirmed = true`. If `confirmed = false`, the consent information is merely reflecting your system defaults.

Transcend Consent Management data also contains a timestamp that you can compare to your legacy consent information.

```javascript
const existingConsentTimestamp = Date.parse(
  airgap?.getConsent?.()?.timestamp || 0,
);
```

#### 2.2 Synchronize Consent to Transcend [#22-synchronize-consent-to-transcend]

After comparing data and timestamps from Transcend and your legacy provider, the most recent information can be sent to Transcend [using airgap.setConsent](../testing-and-troubleshooting/faq.mdx#how-do-i-set-user-consent-from-my-website-ui).

This command requires authorization. Providing authorization for airgap APIs is documented [here](../configuration/consent-ui/creating-your-own-ui.mdx#consent-authorization).

### 3. Export Your Existing Preference Database\* [#3-export-your-existing-preference-database]

<Callout type="info">
  \*_This step only applies if you are using Preference Management._
</Callout>

Create a list of Consent Preferences from your current consent manager, and share that list with your Transcend CX contact.

The list should be built in CSV format, and structured the following way.

```text
id,essential,functional,analytics,advertising,saleofinfo,confirmed,updated,prompted,usp,timestamp
"gregory@transcend.io",true,true,true,false,false,true,true,true,"usp","2023-05-11T19:32:31.707Z"
```

The above fields are based on Transcend's [Sync API endpoint](/docs/api-reference/preferences-client-side/post-consent-sync).

| Column      | Description                                                                               | Values                                                                                                                 |
| ----------- | ----------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| id          | Unique identifier for a user.                                                             | String. You can use any unique identifier. Ex. email for identified users, unique id cookie value for anonymous users. |
| essential   | Consent status for the `Essential` purpose.                                               | `True`/`False`, `yes`/`no` or `0`/`1`                                                                                  |
| functional  | Consent status for the `Functional` purpose.                                              | `True`/`False`, `yes`/`no` or `0`/`1`                                                                                  |
| analytics   | Consent status for the `Analytics` purpose.                                               | `True`/`False`, `yes`/`no` or `0`/`1`                                                                                  |
| advertising | Consent status for the `Advertising` purpose.                                             | `True`/`False`, `yes`/`no` or `0`/`1`                                                                                  |
| saleofinfo  | Consent status for the `Sale Of Info` purpose.                                            | `True`/`False`, `yes`/`no` or `0`/`1`                                                                                  |
| confirmed   | True if user has confirmed consent preferences.                                           | `True`/`False`, `yes`/`no` or `0`/`1`                                                                                  |
| updated     | Has the consent been updated (including no-change confirmation) since default resolution. |  (empty), `null`, `True`/`False`, `yes`/`no` or `0`/`1`                                                                |
| prompted    | Whether or not the UI has been shown to the end-user.                                     |  (empty), `null`, `True`/`False`, `yes`/`no` or `0`/`1`                                                                |
| timestamp   | Timestamp of when consent was collected.                                                  | ISO 8601 Date. Ex. `2023-05-11T19:32:31.707Z`                                                                          |

### 4. Transcend Support Completes Data Import [#4-transcend-support-completes-data-import]

Your Transcend CX contact will import your provided consent data so that your legacy users' preferences are known to Transcend and airgap.

Please allow up to one week for this step to be completed.

### 5. Turn Off Legacy Consent Tool and Complete Transition to Transcend Consent [#5-turn-off-legacy-consent-tool-and-complete-transition-to-transcend-consent]

At this point, your consent data should be imported into Transcend, and airgap should be collecting new consent updates as well as telemetry data.

Before proceeding with the final step, if you haven’t already done so, finalize your airgap configuration by setting up [Consent Experiences](../configuration/regional-experiences.mdx) and triaging your [Data Flows and Cookies](../configuration/triaging-and-telemetry/triage-cookies-and-dataflows-guide.mdx).

You should already be familiar with the overall airgap onboarding process, but don’t hesitate to contact the Transcend CX Team if you have any additional questions.

At this point, you can turn off your legacy consent management solution, and turn off report-only mode from the Transcend dashboard [(Consent Management > Developer Settings)](https://app.transcend.io/consent-manager/developer-settings), in as short a time window as possible.
