Customer Segmentation | User Manual
User Manual - Customer Segmentation
- Installing Customer Segmentation for Magento 2
- Uninstalling Customer Segmentation
- Introducing Customer Segmentation for Magento 2
- Customizing segments
- Integrating Customer Segmentation
- Customer Segmentation Use Cases
Magento 2 Customer Segmentation is a tool for segmenting customers according to their sales history, buying behavior, and other personal details.
Compatibility: Magento Open Source 2.3.X - 2.4.X, Magento Commerce 2.3.X. - 2.4.X
Installing Customer Segmentation for Magento 2
Command Line Installation
- Backup your web directory and store database
- Download the Customer Segmentation installation package
- Upload the contents of the Customer Segmentation installation package to your store root directory
- In the SSH console of your server, navigate to your store root folder:
run the following command:
php -f bin/magento module:enable Aheadworks_CustomerSegmentation
php -f bin/magento setup:upgrade
php -f bin/magento setup:static-content:deploy
5. Flush the store cache; log out from the backend and log in again
Make sure the installation is done from the FTP administrator account. Otherwise, set 775 permissions to the store root directory after the extension has been deployed.
If you are installing an extension from Aheadworks for the first time, you need to add our composer repository to your Magento store:
1. Login to your ssh console and navigate to your store folder:
Run the following command:
composer config repositories.aheadworks composer https://dist.aheadworks.com/
On successful execution of the command you will be able to use the composer to install the extensions.
To install the extension:
2. Login to your ssh console and navigate to your store folder:
3. Run the following command to install the latest version of the extension:
composer require aheadworks/module-customer-segmentation
if you need to install a specific version, run this command:
composer require aheadworks/module-customer-segmentation:<version>
Specify the version of the extension in <version>
When prompted, enter Public Key (Username) and Private Key (Password):
Both Public Key (Username) and Private Key (Password) can be found in My Projects and Licenses in your personal account on our site:
4. Enable the extension:
php -f bin/magento module:enable <Module_Name>
Add the product name in <Module_Name>
Next, register the extension:
Recompile your Magento store if you are in the Production mode:
To verify that the extension is enabled, run this command:
Clean store cache, by running the following command:
Log out and Log in the backend again.
5. Updating Customer Segmentation for Magento 2
Download the updated extension file from Marketplace or another extension developer. Take note of the module-name and version.
Export the contents to your Magento root.
If a composer package exists for the extension, run one of the following.
Update per module name:
composer update Aheadworks/<Module_Name>
Updater per version:
composer update Aheadworks/<Module_Name>:<Module_Version>
Run the following commands to upgrade, deploy, and clean the cache.
php bin/magento setup:upgrade --keep-generated
Uninstalling Customer Segmentation
1. Disable the module by executing the following commands:
php bin/magento module:disable Aheadworks_CustomerSegmentation
2. Remove the extension files from the following folder:
Automatic Removal (via Composer)
1. Disable the module by executing the following commands:
php bin/magento module:uninstall <Module_Name>
Introducing Customer Segmentation for Magento 2
The Customer Segmentation extension for Magento 2 presents a tool to draw various segments of customers according to a number of customized rules and conditions. With the extension you are able to:
- Segment both registered and guest customers;
- Customize rules and conditions for segmentation against a variety of parameters;
- Use customers purchase track record, personal details and other information as parametres for segmentation;
- Integrate the extension with the native Magento Newsletter and Cart Price Rules;
- Move segments to groups;
- Export segmented data to CSV or XML.
The latest versions of the extension (1.2.3) enable the following:
- Integration with Advanced Reports
To start work with the Magento 2 Customer Segmentation go to Customers> Customer Segmentation by Aheadworks > Customer Segments.
Customer Segments Page
This is where you may view, edit the segments as well as add new ones. The segments are allocated into a table with four columns: Rule ID, Segment, Website, Status and Newsletter Subscription Status, which represent some most important details of segments settings. The table is easily customizable and searchable with the 'Columns', 'Default View' and 'Filters' active elements on the top right of the page.
Should you require further support beyond the present manual click 'Customer Segments' folding list and opt for Get Support.
You may enable, disable or delete available segments individually or in bulk. Tick the boxes next to the chosen segments on the left of the table, click the 'Actions' folding list and opt for an operation.
To edit a segment click the active link of the segment name, to add a new segment click the 'Add New Segment' button on the top right of the page. These operations will take you to the Edit/New Segment page.
New Segment and Edit Segment Pages
The New Segment and Edit Segment pages look identical, the name suggests the operation you are to do with the segment. This is where you may alter or add all the details of the segment, define rules for segmentation, and lookup for matched customers.
The image below reflects some basic details you are suggested to provide for each segment. They are as follows:
- Status - enable or disable the segment here;
- Segment Name - provide a name for the segment;
- Description - give details on the segment;
- Assign to Website/Store view - the extension will index the data from the selected websites and store views only;
- Newsletter Subscription Status - opt for a subscription status of customers who fall under the segment.
The extension will reindex all enabled segments daily, so it is recommended to disable the unused ones to save time on reindexing.
Prior settings of the segment sorted, you may now proceed to the Conditions block of the segment.
Conditioning the segments
The Conditions block of the Edit/New Segment page allows:
- Validating Customer Emails - enter the emails of the customers you think fall under segmentation for quick and fast check thereof
- Customizing rules for segmentation - condition the rules for segmentation
Unlike building a whole segment, the Validating Customer Emails option doesn't require reindexing, so it is a good option to verify whether the rule you have created is correct.
To add conditions for segmentation click on the Add button and choose an attribute for conditioning. For further configuration proceed to the 'ALL', 'TRUE', 'IS', '...' and other clickable parameters to alter them in accordance with your rule.
Pay attention to the limitations of Bundle Product type: the extension doesn't look for the attribute values in children products of a bundle, so if you need to find customers who purchased a bundle product, it is recommended to create conditions "SKU is/is not/contains/doesn't contain".
From a performance perspective, it is recommended to put date conditions on a level as high as possible.
When the rule is set, proceed to one of the following:
- New segment - click the 'Save' button and reindex the rule.
- Edit segment - click the 'Save' button, reindex the rule and refresh the page.
Run the following commands for reindexing:
1. In the SSH console of your server, navigate to your store root folder:
run the following command:
Please check more information in the Segmentation Use Cases to familiarise yourself with some examples of most demanded rules for segmentation.
To delete a condition click on the Delete (red cross) button.
Once the rule is set, saved and reindexed, you will be able to check the customers who match the segmentation, move them to groups or export to CSV.
Checking segmented customers
After reindexing is done, scroll down the Edit/New Segment page to the 'Matched Customers' block to check the customers who match the segmentation. The list comes as a table with the following columns, the names of which speak for their content: Name, Email, Group, Country, Phone, Zip, State, City and Address. You may customize the view of the table the 'Columns', 'Default View' and 'Filters' active elements on the top right of the page.
To export the segment click 'Export' and choose the format of the file: CSV or XML.
To move the segment to a group select the customer entries, click 'Actions' and then 'Move to customer group'. A list of groups available will pop-up, where you will be able to finilize the operation.
Integrating Customer Segmentation
Logic of disabled segments
Intergration with Customer Segmentation presumes that the cooperating module will either receive a list of segments or feature the segment criteria and segments in rule conditioning. All segments, enabled and disabled, will be shown in the list/rule. The disabled segments will have a corresponding indication of thereof.
If a disabled segment is selected in a rule, the rule will not trigger. If several segments are selected and some of them are enabled, the rule will be validated only against the enabled segments.
A vendor creates a generic offer for customers representing a few segments. When one of the segments is disabled, no customer from this segment will receive the offer. Customers from other enabled segments, on the contrary, will keep on receiving the offer.
Logic of multiple websites
Magento 2 allows setting up multiple websites. The Multiple Website feature means that you can run more than one website from a similar Magento installation. You manage multiple websites from a single domain dashboard.
If a customer scope is Global, the extension always checks the quantity of all orders, disregarding what website is set in the rule.
If a segment is selected from Website2, for a rule from Website1, that rule will not be applied. Make sure the segments come from the same website as the rules.
Be careful removing the websites (stores, store views). When a website is removed, the link between the segment and the site is removed too. Consequently, the segment can be assigned to none of the available websites. Manual segment updating by a store admin may then be required.
Integration with native Magento 2 modules
Customer Segmentation for Magento 2 allows for a few useful integrations, which help your promotional campaigns be more targeted and therefore effective. Once installed the module will integrate itself into the Cart Price Rules and Native Magento Newsletter.
Cart Price Rules Integration
To fine-tune the coupons as well as some other discounts which are to be applied at check-out or in cart with regard to a particular customer segment go to Marketing > Cart Price Rules. Pick up a rule from the list or start a new one. Complete the essentials and move down to the Customer Segments. Here you will find a list of segments available for selection.
Once you make up your choice and finalize the settings, the discount or coupon will be available only to registered customers in the chosen segment.
Native Magento Newsletter Integration
To personalize you email newsletters you may resort to a Customer Segments block too. This time you will have to proceed to Marketing > Newsletter Queue. Click a queue for editing and scroll the list of settings down to the Customer Segments block. Finalize the queue, save the newsletter, and it will only be delivered to those registered customers who fall into the chosen segment.
Integration with Aheadworks modules
Content Management modules
Customer Segmentation for Magento 2 can noticeably enhance the functionality of a few Aheadworks modules, basically meant to display all sorts of content, namely:
Customer Segmentation for Magento 2 allows specifying the display of content to customer segments.
For the present extension to integrate well with Rich Banner Slider and Automatic Related Products please enable the "Compatibility with frontend extensions" option in Stores → Configuration → Aheadworks → Customer Segmentation.
It is not essential to have the option enabled for other extensions from the list above since they do not display cachable content, based on customer segments. Having it otherwise will not affect the operation of the modules, though will increase the number of cached files and subsequently (though not necessarily to a radical extend) slow down the store.
It’s highly recommended to keep Customer Segmentation index updated. Refresh Full Page Cache after any modifications to the segments to eliminate incorrect content on the frontend.
Integration with Company Accounts for Magento 2 allows Customer Segmentation for Magento 2 to specify companies into segments, which can then be used to fine-tune various marketing campaigns.
When the Company Accounts for Magento 2 module is enabled on the store, the Create/Edit Segment page has the following updates:
- The Apply To configuration option is added to the Conditions tab. This is where you can specify if the segment is to include customers or companies. Thereby the two alternatives of the drop-down: Customer (by default) / Company. When Company is selected, the rule configuration block exchanges customer attributes to the company ones.
- The Company column is added to the Matched Customers grid. The column can be filtered, sorted and hidden.
If a Company matches the rule, all members of the Company get into the given segment.
A note to developer
To get the array of segment ids assigned to a customer, a developer is to use an instance of the class:
Magento\Framework\App\Http\Context, method getValue(), parameter $name = 'aw_cs_customer_segment_ids'
see the following constant for reference
Integration with Advanced Reports
From the Customer Segmentation module version 1.2.3 or new, when Advanced Reports for Magento 2 is installed on the store, it becomes possible to specify segments, which can then be used as a filter for Advanced Reports. The filter by Customer Segments will work in both modules.
The logic is the following:
- the sales data in the report are being related to a Customer segment list. When the user chooses the customer segment according to this the data in the report's grid are filtered.
When Filter by AW Customer Segments is enabled on the store, the drop-down with the created customer segments appears; if the filter is disabled the drop-down is hidden.
Customer Segmentation Use Cases
Below you may find some sample rules for segmentation of customers alonside the explanations for the use cases.
1. List of clients who ordered a specific product at least 2 times
“Number of Orders equals or greater than 2” filters out the customers who have only 1 order which contains 2 items of the same SKU. If this is not essential, you can set that value to 1.
2. List of clients who made a purchase at least 3 times since 11/01/2017
3. List of clients who made a purchase at least two times during the past year for a global amount equals or greater than 200€
4. List of clients who ordered products of a specific brand in May 2019
5. List of clients who ordered products of a specific brand in the last 3 months
Same idea as in the previous example with the only difference: Date From/To is replaced with the Date Period.
From a performance perspective, it is recommended to put the date conditions on a level as high as possible. For example, same result can be obtained should you do otherwise, however, such configuration will require an additional subrequest. While this will not be noticeable in smaller stores, it can save some time on reindexing in the stores with 100k+ orders.
6. List of clients who ordered a product from the specific categories
7. List of clients who has the order(s) with a total of 100€ or more
8. List of clients whose billing address is not in USA
9. List of clients who have an account but did not order
In this example, all customer groups were selected.
10. List of female clients older than 50 years old
11. List of clients who used a promotion code at least once
12. List of clients who bought a printer more than a year ago, but didn’t order ink or toner for the last year