# AI-assisted integration (Beta)

Use AI assistance to speed up the integration process.&#x20;

{% hint style="info" %}
**Requirements**:

1. Project built with Unity.&#x20;
2. The project does not have devtodev integration yet. \
   Projects with poorily integrated events can also participate.
3. AI coding agent that have access to the complete application code.&#x20;
   {% endhint %}

If you have any questions regarding the integration, let us know by using the [`Contact Us`](https://www.devtodev.com/contact-us) form or reach out to our Customer Success team directly within the platform. We will also greatly appreciate your feedback. \
Please add **AI INTEGRATION** when submitting your request.&#x20;

{% hint style="success" %}
We created this manual for [**Cursor**](https://www.cursor.com/) AI code editor but you can try using other AI coding agents that can access all of application code files.&#x20;
{% endhint %}

{% embed url="<https://youtu.be/WZh78nSMc48>" %}
This example is for game application made with Unity, however, the process is similar for other applications types
{% endembed %}

## Preparation and prompt

### Get **Unity Integration Guide File**

Download the **Unity Integration Guide File** and add it to your Unity project folder. \
We recommend creating a folder called `docs` and placing the guide inside it. This ensures the **AI coding agent** can easily access and use it during analysis.&#x20;

{% file src="<https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FTFESdYTCrPuKb5eN1PEK%2Fdevtodev%20AI%20integration%20guide.zip?alt=media&token=43933b3d-0452-4440-9a54-839afaf32dfd>" %}
Unity Integration Guide File
{% endfile %}

Open your AI-agent, and select your Unity project folder. The agent will begin indexing all project files, including the markdown guide. Wait a few moments until indexing is complete. &#x20;

### Create prompt&#x20;

Create a **clear and effective prompt** for the AI-agent.\
The prompt should:

* Assign the AI a role (like "You are a product engineer").
* Specify your goal: integrate DevToDev events properly.
* Reference the guide using `@devtodev_unity_integration_guide.md`.

Copy and paste the prompt text into the AI-agent chat window.&#x20;

You can use our [**prompt**](#get-unity-integration-guide-file) as an example.&#x20;

{% hint style="info" %}
The prompt accuracy is estimated at **around 90%**, which means that some devtodev method calls may contain errors. Therefore, it’s recommended that developers review the integration code.
{% endhint %}

### Add references to integration guide

Attach the guide file inside the prompt. You can do this in two ways:

1. Find all the guide mentions in the prompt and delete that placeholder text. Then, drag the file from the `docs` folder into the chat window. The AI-agent will automatically recognize and link the file.&#x20;
2. Alternatively, type `@` and start typing "devtodev" — the agent will suggest the guide file. Usually it is at the top of the list.&#x20;

<figure><img src="https://2105883905-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LnGcP_ZeRJ1ipj9O8dF%2Fuploads%2FvALmUEBax4YIwblyn7H8%2Fcursor%20screen%20send.png?alt=media&#x26;token=66b42ab2-3bae-4519-bdc2-fcc0a7057554" alt=""><figcaption></figcaption></figure>

Now click **`Send`** and let the AI coding agent generate the integration.

It will:

* Analyze your codebase
* Understand game logic
* Suggest where and how to insert DevToDev analytics events.

## Events generation&#x20;

Check and review the list of events generated by the AI-agent. You can edit the list by removing the unnecessary or duplicate events. You can also ask the AI to revise its suggestions.&#x20;

After you have finished reviewing and modifying the suggested events file, you can proceed to the next step of integration.&#x20;\
The AI-agent may then generate a new class — usually something like `AnalyticsManager` — to send events to Devtodev.

## Further integration&#x20;

The coding agent might show some errors if Unity has not recompiled yet. Switch to the **Unity Editor** and wait for it to finish compiling. Once done, the errors in AI-agent will disappear.

{% hint style="warning" %}
The AI **must not change** your original game logic.

It may **add** analytics calls (like `DTDAnalytics.CustomEvent(...)`), but should never modify player behavior, game flow, or state handling.

If something looks wrong, ask the AI-agent to revise it.
{% endhint %}

After generating the integration, the AI-agent will also produce a **documentation file** (like `ANALYTICS_SETUP.md`).

It describes:

* Where events were added
* How to use the generated `AnalyticsManager` class
* What next steps are required to finish setup.

Follow that instruction carefully to complete your devtodev analytics integration properly.
