> For the complete documentation index, see [llms.txt](https://doc.batch.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.batch.com/developer/sdk/cordova/profile-data/data-migration.md).

# Profile data migration

To make it easier to collect data to a Profile, Batch has added two automatic ways to migrate old installation's data on a Profile:

* User will be automatically identified (logged-in) if he had a Batch `custom_user_id` set on the local storage.
* User natives (language/region) and custom data will be automatically migrated to a Profile.

These migrations are triggered when your application on the dashboard is attached to a Project. Concretely this mean that there's two possible scenarios:

* Your app is running on the plugin v5 or before and is already attached to a Project : migrations will be triggered on the first start running on plugin v6.
* Your app is running on the plugin v6 but not attached to a Project: migrations will be triggered on the first start after your app is attached to a project.

These migrations are enabled by default, but you may want to disable them, to do so update your sdk configuration setup as following:

```javascript
    batch.setConfig({
      iOSAPIKey:"<YOUR_IOS_APIKEY>",
      androidAPIKey:"<YOUR_ANDROID_APIKEY>",
      migrations: { 
        // Whether Batch should automatically identify logged-in user when running the SDK for the first time.
        // This mean user with a custom_user_id will be automatically attached a to a Profile and could be targeted within a Project scope.
        profileCustomIdMigrationEnabled: false,
        
        // Whether Batch should automatically attach current installation's data (language/region/customDataAttributes...)-->
        // to the User's Profile when running the SDK for the first time.
        profileCustomDataMigrationEnabled: false,
      }
    });
    batch.start();
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://doc.batch.com/developer/sdk/cordova/profile-data/data-migration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
