Skip to content

Sales Attribution


The Sales Attribution module for Magento 2 aims to track the sales generated via affiliates. The module tracks the order if the customer places an order using the Affiliate URL. So it will be easier to calculate the revenue generated by the affiliate, and based on that, the Store owner can pay commission outside of Magento.


Sales Attribution module is compatible with the following Magento platforms:

Community Edition (Open Source) Enterprise Edition (Commerce) Cloud Edition
2.3.0 - 2.4.* 2.3.0 - 2.4.* 2.3.0 - 2.4.*


Installing module using zip file

  • Unzip and paste the extension file into your root Magento folder.
  • Connect to your server by SSH.
  • Go to your Magento root folder.
  • To install the extension, perform this command:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy

Composer installation

If you haven't installed any Aitoc module before, in that case, first, you will need to add your Aitoc composer repository. Please go through the document to see how you can add the composer repository.

To install the module, you will need to run the following commands:

composer require aitoc/module-sales-attribution
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
  • To switch the extension on/off, perform these commands:
php bin/magento module:enable Aitoc_SalesAttribution
php bin/magento module:disable Aitoc_SalesAttribution
  • To update the module, use below command:
composer update aitoc/module-sales-attribution

How module works

The module works around three parameters:

  • affiliate_id = This is an integer value representing the affiliate identity (Defined outside of module and Magento).
  • product_sku = SKU of your website's product
  • page = URL Key of category or any content page. For ex: page=category%2Fsub-category%2Fsomething.html

Affiliates will have the link to your website using the above parameters when the user redirects to your website, the module checks if the mentioned parameters are available in the URL.

Sample URL for specific product

Sample URL for specific page


If both product_sku and page attribute are present in URL Key, it will redirect the user to a product detail page, and the page URL Key attribute won't get considered.

It is the URL that affiliates will have mentioned, and the user will be redirected to your site when they click on it. Once the user redirects to your website and valid parameters are available in the URL, the order detail page in admin will display the Affiliate ID value after placing an order.

This value will also be available when exporting order data so the store owner can easily track sales generated by the affiliate.

The module will add affiliate_id_lifespan & affiliate_id cookie when a user redirects to your website from affiliates.

  • affiliate_id_lifespan - This helps to identify the cookie's lifespan. If a present cookie on the browser is old / cookie lifespan has already passed when the user places an order, the affiliate id value on the order will be blank.

  • affiliate_id - Saved the ID of affiliate from URL using which user redirected to the website

Config settings

STORES > CONFIGURATION > AITOC EXTENSIONS > Sales Attribution OR AITOC > Sales Attribution > Configuration

Cookie lifespan (in days): The value entered will define the cookie expiration time. By default, it will take 14 days as cookie expiration time.