> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eykdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Magento 2

> Connect your Magento 2 database to Eyk, so your orders, products and customers land in BigQuery and power your sales reports.

Connect Magento 2 to Eyk to collect your orders, products and customers.

To give Eyk access for server-side tracking instead, see [Magento 2](https://docs.eykdata.com/tracking/magento-2.md) under Server-side tracking.

## What Eyk builds from this data

Eyk copies your orders, products and customers into your own BigQuery project. BigQuery is the data warehouse Eyk sets up for you. Data from all your stores lands in the same tables, so you can compare stores side by side.

| Table in BigQuery | What it holds |
| - | - |
| `fact_sales_items` | Every order line, with its discounts, refunds, shipping, taxes and costs |
| `dim_product_variants` | Your product catalog, down to each variant |
| `dim_customers` | Each customer once, with their country and marketing consent |
| `fact_attributions` | Your revenue per marketing channel, campaign and ad, for each attribution model |
| `rfm_segmentation_scores` | Each customer's RFM segment, with how recently, how often and how much they buy |
| `rfm_segmentation_segment_descriptives` | Each RFM segment, with its number of customers and their average orders and spend |

In Canvas and Alvin AI, these tables show up as **Sales**, **Product Variants**, **Customers** and **Attributions**. Attribution needs Eyk's first-party tracking on your website. Eyk builds the RFM tables when RFM segmentation is on for your organization.

Connect an ad platform too, to see your return on ad spend and your profit after ad spend next to your sales. To open your BigQuery project, click **Google BigQuery** at the bottom of the Eyk sidebar.

## Before you start

You need:

* The address, port, name, username and password of your Magento MySQL database. Your hosting provider has these details.
* Access to the **Sources** page in Eyk.

Setup has two parts. First you let Eyk's server reach your database. Then you enter the database details in Eyk.

## Part 1: Give Eyk access to your database

**1. Whitelist the Eyk IP address**

Add `34.34.83.121` to the IP addresses that may connect to your MySQL database. Whitelisting means your database only accepts connections from the addresses on its list. Do this in the control panel of your hosting provider or in your server's firewall.

> [!NOTE]
>
> If you cannot whitelist an IP address, Eyk connects over an SSH tunnel instead. Follow [Magento SSH access](https://docs.eykdata.com/guides/magento-ssh-access.md).

## Part 2: Add the source in Eyk

**1. Open the source library**

In Eyk, go to **Sources** and click **Add new source**.

**2. Select Magento 2**

In the **Data source library**, click **Add** next to **Magento 2**.

**3. Enter your database details**

Enter your database details under **Database host address**, **Database host port**, **Database name**, **Database username** and **Database password**.

![Magento 2 source form in Eyk with the five database fields](https://mintcdn.com/eyk-data/bLMX2sfOr9PtO8G_/images/sources/magento-2-eyk-form.png?fit=max\&auto=format\&n=bLMX2sfOr9PtO8G_\&q=85\&s=e9f2ef783ec4eee0815cec897281a842)

**4. Choose store views**

To collect data for some store views only, enter their IDs under **Store view IDs (optional)**. Leave it empty to collect data for all store views.

**5. Add the source**

Click **Add source**.

## Check it worked

In Eyk, go to **Sources**. Magento 2 is in the list with the text **Your data source is connected.** Eyk updates your BigQuery tables every night.

## Troubleshooting

> [accordion] Eyk could not connect to the MySQL database
>
> Check that `34.34.83.121` is on the whitelist of your database. Then check the database address, port, name, username and password in the Magento 2 source in Eyk.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.