Tracking – Product categorization
Discover the most-read articles
Product categorization is an advanced integration that splits your conversions by the type of product purchased. Each category gets its own Affilae key, and the script triggers the conversion matching the products actually present in the cart.
You can therefore reward a furniture sale and a book sale differently, with one commission rule per category.
What a product categorization integration does
This integration consists of:
- segmenting products by business categories (for example electronics, apparel, books);
- assigning specific Affilae KEYS to each category;
- automatically calculating amounts by category for each order;
- triggering the appropriate conversions according to the products in the cart.
Technical prerequisites
Required configuration
- An e-commerce Data Layer correctly configured.
- The product variables available in that Data Layer.
Two ways to install the integration
- GTM integration (client-side): with a Custom HTML tag.
- Custom integration (native code): direct integration in the confirmation page code.
Example code
Below is an example implementation for 4 product categories.
Adapting the code to your shop
- Define your categories according to your needs, for example books, fashion, games, furniture.
- Map your product IDs. List all product IDs for each category, use them exactly as they appear in your DataLayer, and verify consistency with your available variables.
- Configure your Affilae KEYS. One unique key per category, in the format provided by your Affilae account manager. Testing is mandatory before going live.
Where to find your keys and your IDs
- In the sidebar, open Manage programs, then click your program name.
- Click Configuration.
- Open the Tracking tab.
- Expand the Integration via an Affilae plugin section: it shows the Program ID, the Rule ID, the Currency and the Key of each rule.

Points of attention
- Check your DataLayer structure before installing the tag.
- Test with real orders.
- Verify calculated amounts and the various category triggers.
- A product missing from your ID lists triggers no conversion at all: keep those lists up to date every time you add references to your catalogue.
Related articles
- Testing click and conversion tracking
- Integrating scripts via Google Tag Manager
- Frequently asked questions on technical integration
- Product feeds: what they are for and what your file must contain
- Affilae tracking fundamentals
Frequently asked questions
Check the Program ID. That is the value tying the click script to your program. You find it in Manage programs, your program, Configuration, Tracking tab, Integration via an Affilae plugin section.
Check three things, in this order. The variables of your dataLayer, the product IDs you listed in the code, and the Affilae KEYS used for each category. A single wrong value among those three is enough to make the conversion disappear with no error message.
In your program configuration, Tracking tab, Integration via an Affilae plugin section. It shows the Program ID, the Rule ID, the Currency and the Key. The key format is provided by your Affilae account manager.
Yes. In Affilae, an event, here the sale of a product in a given category, corresponds to a commission rule, and therefore to a key. You create as many rules as there are categories to track.
No conversion is triggered for that product, since its ID matches none of the lists in the code. Remember to update those lists every time you add references to your catalogue.
No, testing is mandatory before going live. Place a real order per category, then check the calculated amounts and the trigger of each conversion. If in doubt, contact Affilae support with the details of your configurations.