Views: 379
Number of votes: 4
Average rating:

New Nuget packages for our Episerver Personalization suite

Hello!

For those of you which have already seen it or for you that might be curious in upcoming or current projects, since March this year we had our nuget packages for our Episerver Personalization suite public on Episerver nuget.

These nuget packages where listed as Beta since we wanted to make a thorough job to improving and incorporating these into our new offers in the Personalization field.

Those were:

  • Reach for intelligent email recommendations
  • Perform for AI product recommendations

Now we are adding new packages for the above and also for:

  • Tracking for our Profile Store and to be visualized in Insight, our journey visualization tool (coming now in Q4)
  • Our brand new Personalized Find for enterprise browse and site search which we just released (!!)

We will also introduce packages for Advance which is the AI content personalization that we are releasing in Q1.

Alot of things are happening, hope you are as excited as we are.

So, back to the packages.

To make this more modular we are now releasing a new set of nuget packages which will simplify the integration with our Episerver Personalization suite.

But first, to be able to explain the new packages, let’s look at the old nuget packages that we had:

The nuget packages that were in Beta were called Episerver.Recommendations and Episerver.Recommendations.Commerce, and as I mentioned before, we only supported Episerver Perform which is our product recommendations and also tracking for our email recommendations called Episerver Reach, inside the Episerver Personalization suite.

In these nuget packages we gave you the possibility to use our controller tracking on each PageController and an optional tracking service through a TrackingFactory for usage outside or even inside a controller if you wish. We also provided a catalog export to export products to the service.

 

The controller tracking where applied like this:

(This is an example for a Start Page with the GetRecommendationsGroups method to retrieve the recommendations inside the controller)

[Tracking(TrackingType.Home)]
public ViewResult Index(StartPage currentPage)   
{    

var recommendations = this.GetRecommendationGroups(); 

 }
 

And the TrackingService where used like this:

var trackingData =_trackingDataFactory.CreateCategoryTrackingData(category, httpContext);
var result = _trackingService.Send(trackingData, httpContext, RetrieveRecommendationMode.Enabled); 
var productRefs = result.SmartRecs ?.Where(x => x.Position == Category).SelectMany(x => x.Recs).Select(x => _referenceConverter.GetContentLink(x.RefCode));

A quick note: In each page for Episerver Perform, our product recommendations, you could have several widgets. Widgets is the actual recommendations area, for example a page contains one “Top Sellers” widget and one “Recommended for you” widget on the start page, this is then one controller and two widgets to be rendered with it.

 

So, now to the new packaging:

 

I will explain these packages one by one to make it clearer:

 

  1. Tracking.Commerce - Will be handling the tracking for Episerver Perform and Episerver Reach, this can be joined with Episerver.Profiles.Client to also track users through the Profile Store integration. This tracking will track all profiles so they can be visualized in Episerver Insight which is built on top of our new Data Management Platform. The profiles that are created are reusable cross all Personalization products, for example to be used in Personalized Find to give an individualized search and navigation result based on what they’ve searched or browsed on before.
  2. Personalization.Common – A small support package that handles the common integration for our Personalization products such as connecting other Personalization products to our brand new Personalized Find.
  3. Personalization.Commerce – This package will handle the previous integration with Episerver Perform and also supports Personalized Find with the new Episerver.Find.Personalization package which depends on Episerver.Personalization.Commerce.

    This package also contains the new catalog export which I will describe more thoroughly further down in this post.

Image Namnlös.png

Image Namnlös1.png

 

New Tracking:

 

The tracking attributes for the controllers have also changed and are now decorated on the controller as “CommerceTracking”. An example how that looks like is described here:

 

[CommerceTracking(TrackingType.ProductPage)]
public ViewResult Index(ProductPage currentPage)

{

var recommendations = this.GetRecommendationGroups();

}

The tracking service is used like this, similar to before:

var trackingData = _trackingDataFactory.CreateCategoryTrackingData(category, httpContext);
var result = _trackingService.Track(trackingData, httpContext, currentContent); 
var recommendations = result.GetRecommendationGroups();

 

An example how this is then rendered in the Index.cshtml file for the product page is described here:

 

@section RightMarginRecommendations {@{ Html.RenderAction("Index", "Recommendations", new { recommendations = Model.AlternativeProducts });}}

 

@section BottomRecommendations {@{ Html.RenderAction("Index", "Recommendations", new { recommendations = Model.CrossSellProducts });}}

Let’s leave that for now and dig a little deeper into the brand new catalog export as well.

 

The new Catalog Export:

 

With this release, we are also releasing a new catalog export to better support exports from Commerce to our Personalization suite.

The new catalog exports now support more in terms of extendibility than the previous one.

 

Examples of what you can do with the new export:

 

  • Skip products (or variants of a product) based on custom logic. The default only takes the item's Publish state into account.

  • Customize calculation of inventory quantity for products and variants. The default will sum the available quantity across all warehouses (and for the product, across all variants).

  • Customize which URL is used for the product and for the product image. The default is to use the product detail page and the first available asset (filtered by a configured asset key, if present).

  • Customize the title, description and other attributes of the product. The default will use DisplayName/Name for title, a property set in configuration for description and include all other non-system properties.

  • Customize the list price and sale price of the product (this is not new, but listed here for completeness).

I will now show you a small code example how you could use the customization of product attributes, in this example we remove the Description from MyProdctType to be excluded from the export to Episerver Personalization:

 

//The new namespace for the catalog feed

namespace CodeSamples.EPiServer.Personalization.Commerce.CatalogFeed

{

//Class for defining the MyProductType

    public class MyProductType : ProductContent

    {

        public virtual string ProductDescription { get; set; }

 

        public virtual bool ExcludeFromProductFeed { get; set; }

    }

}

 

//Removing the attribute “Description” before export

public IDictionary<string, string> GetAttributes(EntryContentBase entryContent)

        {

            var attributes = _defaultImplementation.GetAttributes(entryContent);

 

            if (entryContent is MyProductType)

            {

                // MyProductType uses the ProductDescription property as description, so

                // remove it here to avoid duplication

                attributes.Remove("ProductDescription");

            }

 

            return attributes;

        }



 

That was all about the new nuget packages in this blog post, you can read up on this more in detail on Episerver World:

 

http://world.episerver.com/documentation/developer-guides/commerce/personalization/recommendations/ 

http://world.episerver.com/documentation/developer-guides/commerce/personalization/customizing-exported-product-information/

 

A last note:

 For those of you that already are running our Beta packages or are about too, there will be breaking changes, we urge you to review our documentation on Episerver World to be up to date and look through our developers guides.

Our new packages will be updated with our continuous releases, the old Beta packages will be deprecated and removed at a later state.

If you want to read more about Episerver Personalization with focus on Perform in Marcus blog, please visit the link below. His blog post surrounds the usage of Episerver Personalization from a user perspective.

Get started with Episerver Perform for personalized product recommendations

 

Until next time, happy coding!

  Please login to post a comment