Overview
Magento v2 has been rebranded to Adobe Commerce. The functionality remains the same.
The Cordial extension for Magento version 2 (now called Adobe Commerce) 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: magento2-2.4.6-p3.zip extension (updated February, 5 2024).
Supported versions include 2.3.5 and aboveāand PHP up to 8.2. 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.
Install the 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 track.cordial.io 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
In the examples below, replace $accountkey
with your Cordial account key.
USW1
If you log in to your Cordial account using the address https://admin.cordial.io, you will use the following code:
(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', '//track.cordial.io/track.v2.debug.js', 'crdl');
crdl('connect', '$accountkey', {
trackUrl: "//track-ehs-svc.cordial.com" ,
connectUrl: "//track.cordial.io" ,
cookieDomain: "cordial.io",
cookieLife: 365
});
USW2
If you log in to your Cordial account using the address https://usw2.admin.cordial.io, you will use the following code:
(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', '//track.usw2.cordial.com/track.v2.js', 'crdl'); crdl('connect', '$accountkey', { trackUrl: "//track-ehs-svc.usw2.cordial.com" , connectUrl: "//track.usw2.cordial.com" , cookieDomain: "cordial.com", cookieLife: 365 });
Staging
Use the following code for your staging site. These snippets should be included before the closing body tag of the site or site template, with the placeholder account key value updated for your account:
(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', '//track.stg.cordialdev.com/track.v2.js', 'crdl'); crdl('connect', '$accountkey', { trackUrl: "//track-ehs-svc.stg.cordialdev.com" , connectUrl: "//track.stg.cordialdev.com" , cookieDomain: "cordialdev.com", cookieLife: 365 });
Production
In production, your code snippet should look more like this (using your vanity domain and Cordial account key):
(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', '//d.email.example.com/track.v2.js', 'crdl'); crdl('connect', '$accountkey', { trackUrl: "//se.email.example.com" , connectUrl: "//d.email.example.com" , cookieDomain: "email.example.com", 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: 0.0.0.0/0.
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 api.usw2.cordial.io
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, navigate to Settings > Account Settings and copy the account key 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 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
Comments
0 comments
Please sign in to leave a comment.