Why? Just store lists of bought product ids in its own database, then compute some statistics on it. Zero customer or user involvement is needed in that process.
- if you keep a reference to specific user (like "your friend toto bought this") then you need consent
- if you keep a reference to "user category/generic profile" then it's anonymized so no need for consent
- if your profile is build on all the orders of your different users but without user informations, then it seem fine to me... because of anonymity