Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Question about RecommendationId



Using native integration, we were able to track products recommendations clicks by following this documentaion:

Above documentaion assumes that customers will click on a product, returned from Perform engine, then they will be redirected to product details page where the tracking is taken place. (RecommendationId is added to the URL)

My question is how the tracking would work if AddToCart button is shown within recommened products thumbnail. The customer will not be redirected to product details page but item will be added to the cart directly. How can we show, in Perform portal, that this product was added to cart because of a recommendation by EPiServer Perform? Maybe it is happening already, I am just asking to make sure we didn't miss anything.


Aug 20, 2019 21:22

I'd first suggest familiarising yourself with the following articles


You don't need to rely on controller attributes etc. you can fire off tracking events however you wish. 

For a working example of using both attributes and then custom server-server tracking, look not further than Quicksilver (

So whether you want to fire off a clientside track or any controller method track - you can do this exactly when and how you like.

Aug 21, 2019 1:20

Thanks Marcus for your reply!

The working example in QuickSilver taking into consideration that item will be clicked and user will be redirected to product details page where they can get the RecommendationId from the context.

I think this same as what is mentioned in this documentation:

Marking clicks

  • If a user clicks a recommended item, the click must be tracked to generate useful recommendations. To get information about which recommendation triggered the current request, use the EPiServer.Tracking.Commerce.IRecommendationContextinterface.
    • The Quicksilver template has a class, EPiServer.Reference.Commerce.Site.Features.Recommendations.Services.RecommendationContext which implements the above interface, to track clicks on recommended products.

In our website, we have AddToCart button displayed within the recommended product thumbnail. Customer can click add to cart directly without going to product details page. How can we track that this item was added to cart because of EPiServer Perform recommendation?

Aug 22, 2019 19:18

No problem. 

Check out this page: - specifically the section titled 'Tracking without using the CommerceTrackingAttribute'

What you should do is

  1. Create an endpoint that your page can just JS to call to (your add to cart click will fire off a tracking request to your custom endpoint)
  2. In that endpoint you want to crete a tracking object of type 'Basket'  (i.e. var trackingData = _trackingDataFactory.CreateCategoryTrackingData(category, httpContext);)
  3. Populate your tracking object with any additional data needed to be tracked (sent as part of the JS request)
  4. Track the event (i.e. var result = _trackingService.Track(trackingData, httpContext, currentContent);)
Aug 23, 2019 4:56

Makes sense Marcus!

Thanks and appreciate your help.

Aug 23, 2019 16:16
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.