Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Marketing Library

The Marketing library in Ucommerce, enables you to easily integrate your marketing campaigns in your web-applications.

Most of the things that goes on in Marketing foundation happens automatically in the basket pipeline. However adding a voucher is an action performed by the user, and needs to be called by the API.

Advertising is also done using MarketingLibrary, and are great for presenting users with what discounts are available. This article will sum up the different methods available.

Ucommerce.Api.IMarketingLibrary

description

Methods


AddVoucher

  • Return type Boolean
  • Arguments
    • String voucherCode

GetTargetedCampaignItems

  • Return type IList<Ucommerce.EntitiesV2.CampaignItem>
  • Arguments
    • This method is called without any arguments

GetTargetedCampaignItems

  • Return type IList<Ucommerce.EntitiesV2.CampaignItem>
  • Arguments
    • Ucommerce.EntitiesV2.Product product

GetTargetedCampaignItemsForIndividualProducts

  • Return type IList<IList<Ucommerce.EntitiesV2.CampaignItem>>
  • Arguments
    • IEnumerable<Ucommerce.EntitiesV2.Product> products

GetSingleProductCampaignItems

  • Return type ICollection<Ucommerce.EntitiesV2.CampaignItem>
  • Arguments
    • This method is called without any arguments

Adding a Voucher

Vouchers are typed into the UI by the customer, so Ucommerce needs to pick up when this happens. This is done using MarketingLibrary.AddVoucher.

Ucommerce.Api.IMarketingLibrary.AddVoucher

  • Return type System.Boolean
  • Arguments
    • System.String voucherCode

Calling the API

    
    var marketingLibrary = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.IMarketingLibrary>();
    marketingLibrary.AddVoucher(voucherCode);
    

Get Targeted Campaign Items

The GetTargetedCampaignItems() method gives you a list of the targeted campaign items for the current user context. For example all discounts that are relevant to the category or product the user is visiting. For example you can use GetTargetedCampaignItems.

Ucommerce.Api.IMarketingLibrary.GetTargetedCampaignItems

Additional overloads to this method exists

  • Return type System.Collections.Generic.IList`1[Ucommerce.EntitiesV2.CampaignItem]

Calling the API

    
    var marketingLibrary = Ucommerce.Infrastructure.ObjectFactory.Instance.Resolve<Ucommerce.Api.IMarketingLibrary>();
    marketingLibrary.GetTargetedCampaignItems();