Перейти к содержимому

Magento integration guide


Plugin overview#

The ExpertSender CDP plugin not only syncs orders by default but also allows you to collect customer consents directly from your Magento store and submit them to ECDP.

The plugin is compatible with Magento 2.2+.

If you prefer using this feature instead of an API integration for collecting consents, follow these steps:

Order synchronization

  • By default, order information is automatically sent to ECDP. No additional setup is required for this.
  • To ensure order statuses are properly synced, refer to the Order Status Mappings section.

Steps to collect and submit consents

  1. General settings configuration
    Go to the General Settings tab and fill in the necessary fields:
    • API key
    • Tracking code
    • Website ID
  2. Create consents in Magento
    If you want to collect marketing consents (e.g., when users register, edit profiles, or place orders):
    • Go to the Consents tab.
    • Create a consent in Magento and map it to a corresponding marketing consent in ECDP.
  3. Create consent forms
    In the Consent Form Elements tab:
    • Create the forms responsible for collecting consents (e.g., «Checkout consent»).
    • Select where the consent checkbox or form should be displayed (e.g., registration, checkout, profile edit).
    • Choose which consent is collected once the form is submitted.
  4. Configure opt-in mode
    Go to Settings > Form Settings and define whether consents will be collected using Single Opt-In or Double Opt-In. If Double Opt-In is selected, you’ll need to specify the Confirmation Message ID from ECDP.
  5. Optional: Custom data mapping
    If your store collects additional data beyond standard fields (e.g., order, product, or user data):
    • Configure the submission of custom fields in the Custom field mapping tab. This step ensures that non-standard data is sent to ECDP.

Installation & configuration

  1. Install the extension

You can install the ExpertSender CDP extension using either Composer or manually via FTP:

Via composer:
Run the following command in your Magento root directory

composer require expertsender/ecdp

Manually via FTP:

  • Download the plugin from GitHub.
  • Upload the extension files to your Magento server in the following directory: app/code/ExpertSender/Ecdp/
  1. Run Magento commands

After installing the extension (using either method), run the following commands in your Magento root directory to enable and compile the extension:

php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flush

Plugin sections

General settings

  1. Navigate to the Magento admin panel.
  2. Go to ECDP > General Settings.
  3. Here, you need to configure the following fields:
    • API Key: Enter your ExpertSender API Key for authentication.
    • Tracking Code: Add the tracking code to monitor user activity on your site.
    • Website ID: Input your website’s ID for ExpertSender CDP.
    • Enable API Log: If enabled, all requests and responses to/from the ECDP API will be logged in the /var/log/expertsender/api.log file for troubleshooting purposes.

Customer Data settings

To configure how customer data is sent to ECDP:

  1. Navigate to ECDP > Customer Data in the Magento admin panel.
  2. You can configure the source for the customer’s phone number to be sent to ECDP with the following options:
    • Billing Address (default)
    • Shipping Address
  3. Additionally, you can determine whether to send the customer’s phone number to ECDP.
    If you select Yes, ensure that all phone numbers stored in Magento are in international format(including the country prefix), as failing to do so may cause issues during data transmission.

Form settings

To configure forms in ExpertSender CDP:

  1. Navigate to Admin Panel > ECDP > Form Settings.
  2. The General section includes the following fields:
    • Text to display before consents in forms: This is the text that will appear above the list of checkboxes in forms, such as “I agree to:”.
      Note: This text does not display in the newsletter or profile edit forms.
    • Use ExpertSender CDP form: Set whether the plugin should replace the default newsletter form with one that includes consents.
  3. The Single/Double Opt-In section includes options for different forms (registration, profile edit, checkout, newsletter):
    • Form type: Choose between Single Opt-In or Double Opt-In for each form.
    • Confirmation message ID: If Double Opt-In is selected for any form, an additional field will appear where you can enter the ID of the confirmation message. If left empty, the default confirmation message will be sent.

Customer consents

Consents in Magento need to be mapped to consents in ExpertSender CDP to ensure proper synchronization. Follow these steps to create and map a consent:

  1. Navigate to ECDP > Consents > Add New.
  2. Give it a name: This will be the name you use to refer to the consent in Magento.
  3. Select a consent from ECDP: Choose the corresponding consent that was already created in the ExpertSender CDP platform.

Once the consent is created in Magento, it can be used in various forms to start gathering customer subscriptions. These consents will be applied to the following forms:

  • Registration form
  • Profile Update form
  • Checkout form
  • Newsletter form

After creating the consent, you need to specify where and how the consent checkbox or form will be displayed. Here’s how to set up a consent form element:

  1. Navigate to ECDP > Consent Form Elements > Add New.
  2. Add a name: For example, you might name it «Newsletter Consent».
  3. Select a form: Choose where the consent checkbox will appear. You can select from the following options:
    • Registration
    • Profile Edit
    • Checkout
    • Newsletter
  4. Select a consent: Choose the consent you previously created and mapped to ECDP. This consent will be given once the customer checks the box and submits the form.
  5. Select a store: Define in which store views the checkbox will be displayed (Magento’s multi-store functionality).
  6. Enable or disable: Toggle the checkbox to either enable or disable the consent checkbox in the form.
  7. Set sorting order: You can define the display order by assigning a number for the sorting priority. The lower the number, the higher the checkbox will appear in the form.

Custom Field Mappings

Custom Field Mappings enable you to map non-standard fields from Magento with corresponding fields in ECDP. These custom fields go beyond the basic data and might include specific details related to an order, product, or user.

Supported Resources for Custom field mapping

  • Order
  • Product
  • User

Each custom field from these resources can be linked to a pre-defined field in ECDP. It’s important to note that the corresponding field in ECDP must be created before the mapping can occur.

To map specific Magento attributes to ExpertSender CDP features:

  1. Go to ECDP > Custom Fields Mapping.
  2. Click Create to define new mappings:
    • Magento Field: Select the product/user attribute.
    • Mapped Resource: Choose from User, Product, or Order.
    • ExpertSender Field: Choose the corresponding field from ExpertSender.
  3. All created mappings will be listed in the table and will be automatically synced with ExpertSender CDP.

Order Status Mappings

Order Status Mappings allow you to synchronize Magento’s order statuses with corresponding statuses in ECDP. This feature ensures that ECDP is always up-to-date with the latest order status, providing accurate information for reporting and triggering customer communications.

  1. Navigate to ECDP > Order Status Mapping.
  2. Create mappings between Magento order statuses and those in ECDP:
    • ExpertSender Order Status: Select a status (e.g., placed, paid, completed, canceled).
    • Magento Order Status: Choose from Magento’s order statuses.

Default mapping:

ECDP’s StatusMagento’s Status
placedpending, pending_payment, holded
paidprocessing
completedcomplete
canceledcanceled, closed