How can we help?

Magento V2


The Cordial extension for Magento Version 2 provides a turnkey solution to connect your Cordial account with your existing Magento V2 storefront for syncing customer behaviors and data in real time.

In addition to data synchronization, the extension enables you to route all your promotional, triggered, and transactional Magento messages to messages in Cordial.

Install the Cordial extension

Download the extension file and install using the Magento Extension Manager or command line: extension (updated December 16, 2022).

The last officially supported version of Magento 2 is 2.4.4. Support for 2.4.5 is in beta. Contact support or your CSM if you have any questions regarding Magento upgrades and compatibility.

To install the Magento extension via Composer, the module name is cordial/magento2-sync-module 

Configure the Cordial extension

To get started with the Cordial extension you will need to enable the extension, provide your Cordial API and account keys, map customer attributes, and synchronize any existing Magento data.

Enable the Cordial extension

1. In your Magento account, navigate to the Configuration page of the Cordial extension.

2. On the Configuration page, make sure that your store view is set to Default Config.

3. Select Enable using the Cordial Integration dropdown.

JavaScript Listener

The JavaScript Listener script editor allows you to modify script parameters depending on your store configuration. For example, if you're using a vanity domain, add it as the data-cordial-url and t.src value to replace the default entries. This will ensure that all relevant events are being tracked, including order revenue attribution.

When using the JavaScript Listener, the following events are passed to Cordial.

  • category view
  • product view
  • CMS page view
  • products search
  • cart page view
  • checkout success page
  • customer logout
  • customer login

The Magento 2.4.x extension will run with Cordial's JavaScript Listener v1 as well as v2. Versions below 2.4.x will only work with JavaScript Listener v1.

JS v1
requirejs([], function() { var t = document.createElement("script"); t.setAttribute("data-cordial-track-key", "$accountkey"); t.setAttribute("data-cordial-url", ""); t.setAttribute("data-auto-track", false); t.src = '//'; t.async = true; t.onload = cordialMagento; document.body.appendChild(t); });
JS v2
(function(C,O,R,D,I,A,L){ C.CordialObject=I,C[I]=C[I]||function(){(C[I].q=C[I].q||[]).push(arguments)}; C[I].l=1*new Date,C[I].q=[],A=O.createElement(R); L=O.getElementsByTagName(R)[0],A.async=1,A.src=D,L.parentNode.insertBefore(A,L); })(window, document, 'script', '//', 'crdl'); crdl('connect', '$accountkey', { trackUrl: "//" , connectUrl: "//" , cookieDomain: "", cookieLife: 365 });

Add your Cordial API key

1. In your Cordial account, on the API Keys page, create an API key by whitelisting the catch-all IP address:

2. In your Magento account, navigate to Cordial > Configuration.

3. Choose the Default Store View from the Store View dropdown menu.

4. Paste the API Key into the Cordial API Key field and click Save Config. 

Cordial API URLs are specific to the server region for your account. If your account is in US-West2, you'll add

Admins maintain the ability to lock server configurations, making API keys and account settings unable to be edited. Contact your admin for more information.

Add your Cordial Account Key

1. In your Cordial account, copy the account key on the Account Settings page under Account Info.

2. In your Magento account, on the Cordial Configuration page (set to Default Store View), paste the account key in the Cordial Account Key field and click Save Config.

3. Your Cordial account should now be connected to the Magento extension and ready to map customer attributes and synchronize data.

4. When the configuration is saved, the following changes will occur in your Cordial account:

  • A list called Promotional will be added to your account. Contacts will automatically be added to this list if they subscribe on your Magento store.
  • The following contact attributes will be added:
    • lastPurchase
    • m_wishlist
    • magentoAlerts
    • magentoDeleted

Map customer attributes

Before synchronizing Magento customers with your Cordial account, you will need to map all desired attributes. You have the option to map attributes that already exist in your Cordial account, or to create new attributes from within Magento and send them to Cordial.

Map existing Cordial attribute keys

1. Navigate to Cordial > Configuration in your Magento account.

2. Add the desired Cordial Contact Attribute keys and the corresponding Magento Customer Attribute codes in the Customer Attributes Mapping table. Make sure that the Magento attribute codes match the codes in your store.

You can view all your existing customer attributes by navigating to Store > Attributes > Customer (available in Enterprise edition only; see table below for a list of standard customer attributes).

3. You can add more attributes by clicking the Add button.

4. Once you've added all the attributes, click the Save Config button. Cordial attribute keys that already exist in your account will be mapped.

Standard Magento Customer Attribute codes

Magento Customer Attribute code Description
prefix Name Prefix
firstname First Name
middlename Middle Name/Initial
lastname Last Name
suffix Name Suffix
group_id Group
dob Date of Birth
default_billing Default Billing Address
default_shipping Default Shipping Address
taxvat Tax/VAT Number
confirmation Is Confirmed
created_at Created At
gender Gender
updated_at Updated At

Create and map new Cordial attribute keys

  1. Add the desired Cordial attribute keys to the customer attributes mapping table and click Save Config.
  2. Click the Send New Attributes to Cordial button to create and map the new attribute keys.

Synchronize existing data and templates

Once your Magento and Cordial accounts are connected, any future data will automatically synchronize (unless individually disabled). If you have existing data in your Magento account at the time of connection, you can use the Post Data to Cordial option to post all existing data to your Cordial account. You can also post all existing Magento templates into your Cordial account using this method.

You can disable syncing of individual products or customers by turning off Cordial Sync on each product or customer edit page.

Post Magento data to Cordial

1. Navigate to Cordial > Configuration in your Magento account and locate the Post Data to Cordial section.

2. Choose which data collections to post and click Post Data to Cordial.

Posting order data to Cordial will not result in creation of duplicate order records. The post will first check for existing order data, which is updated if found. Otherwise, new order data is added.

When syncing templates, all template code including necessary external variables (extVars) will be saved in Cordial. You can also map Magento templates to existing templates in Cordial on the Template Mapping page.

3. You can check the status of the sync by navigating to Cordial > Sync in your Magento account.

4. Locate the desired Sync job and check the Todo column.

  • If the Todo column contains the value "Nothing," then the sync performed without errors.
  • If the Todo column contains the value "Sync," then there was a problem with the job.

5. You can view the status of any job by navigating to Cordial > Log.

6. Here you can view info on all API calls made to Cordial.

7. To view specific info on an API call and response, click the Select dropdown and choose View. The Log Information will be displayed.

Map transactional templates

You can map Magento templates to automation templates created in Cordial.

1. Navigate to Cordial > Templates Map in your Magento account.

2. Click the Map New Template button.

3. Choose the desired Magento template and Cordial templates to map from the dropdown menus.

4. Click the Save Template button.

Edit existing template mapping

1. Click on the desired template to edit in the template list.

2. Select new templates from the dropdown menus and click Save.

Supported transactional templates

  • Change Email
  • Change Email and Password
  • Contact Form
  • Credit Memo Update
  • Credit Memo Update for Guest
  • Cron Error Warning
  • Currency Update Warnings
  • dotdigital System Alert
  • Footer
  • Forgot Admin Password
  • Forgot Password
  • Hard-declined Authorization
  • Header
  • Invoice Update
  • Invoice Update for Guest
  • New Account
  • New Account Confirmation Key
  • New Account Confirmed
  • New Account Without Password
  • New Credit Memo
  • New Credit Memo for Guest
  • New Invoice
  • New Invoice for Guest
  • New Order
  • New Order for Guest
  • New Shipment
  • New Shipment for Guest
  • New User NotificationOrder Update
  • Order Update for Guest
  • Order is Ready for Pickup
  • Order is Ready for Pickup For Guest
  • Payment Failed
  • Price Alert
  • Remind Password
  • Reset Password
  • Send Product Link to Friend
  • Shipment Update
  • Shipment Update for Guest
  • Sitemap Generation Warnings
  • Soft-declined Authorization
  • Stock Alert
  • Subscription Confirmation
  • Subscription Success
  • Unsubscription Success
  • User Notification
  • Wish List Sharing



Please sign in to leave a comment.