Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

HomeDev guideRecipesAPI Reference
Dev guideUser GuidesLegal TermsNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Commerce Connect + Campaign

Describes the product catalog export from Optimizely Commerce Connect into Optimizely Campaign to gain access to product information to be included in Campaign mailings.

The integration is included in the Optimizely.Campaign.Commerce NuGet package. See installing Optimizely.

The integration periodically transfers the latest product data from Optimizely Commerce Connect to Optimizely Campaign in a CSV format. The integration includes a scheduled job, Export Product Data To Campaign, to carry out this transfer. The job regularly collects Commerce Connect product data and exports it to a CSV file in a specified format. The file is automatically transferred to a specific folder on an Optimizely server. From there, it is imported into Campaign.

Integration details

Prerequisites

You send the public and private keys (also known as a fingerprint) to Optimizely. Then, Optimizely grants access to the system for that key. When setting up the Commerce Connect-Campaign integration, you convert the private key to an SSH key format and save it as a ".key" file. At that point, you use the key to authenticate the file transfer (as explained in episerver:campaign.SSHFilePath).

📘

Note

Contact customer support to get the file name, Campaign client ID, FTP information including root folder directory path, and the path and passphrase to the SSH key file. Ensure that the FTP folder is properly set up prior to the first export.

Transfer file information

  • Product ID
  • Product name
  • Product category, a string showing the category hierarchy delimited by hashtags (#). For example, Fashion#Mens#Mens Shoes.

📘

Note

If a catalog's category exceeds 10 levels, only the first 10 appear in the transfer file.

  • Text fields
  • Image fields
  • Link fields
  • Additional data fields

Semicolons (;) delimit the transfer file elements. If you want to open the file in Excel, choose semicolons in the Delimiter field.

Configuration settings

To enable this transfer, add the following settings to the <appSettings> element of your Commerce web.config file.

Description
episerver:campaign.CatalogNames The list of Commerce catalogs to export is separated by semicolons (;). To export all catalogs, leave the list empty.
episerver:campaign.ExportProductFileNameThe exported product file name. The filename and filename extension configured on the campaign site must match.
For example:
<add key="episerver:campaign.ExportProductFileName" value="OptimizelyFoundationDemoCatalog.csv" />
episerver:campaign.CampaignClientId The Campaign client ID. Provided by Campaign.
episerver:campaign.FTPHostName The FTP host name. Provided by Campaign.
episerver:campaign.FTPPort The FTP port. Provided by Campaign. The default value is 22.
episerver:campaign.FTPUserName The FTP user name. Provided by Campaign.
episerver:campaign.SSHFilePath The path to the SSH key file from the website root. This file transfers the exported file to Optimizely server in SFTP.
For example:
<add key="episerver:campaign.SSHFilePath" value="/campaign\_ssh.key" />
or
<add key="episerver:campaign.SSHFilePath" value="/App\_Data/campaign\_ssh.key" />
episerver:campaign.SSHPassphrase The passphrase of the SSH key file. This value is optional. Leave it empty if you do not configure a passphrase for the SSH key.
episerver:campaign.MarketId The ID of the market whose product data you want to get.
For example: "US" or "SWE".

📘

Note

If the FTP credentials are incorrect, the transfer file is generated in Commerce Connect site but it cannot be transferred to Campaign server. The scheduled job fails.

The product data model

The ProductDataModel class (listed in the table below) contains the data being transferred to Campaign. Each instance of this class refers to a product item in the CSV template. For a more detailed description of product data, see Use CSV.

ItemDescription
IdThe product ID. A unique value for internal use within Campaign.
NameThe product's display name.
CategoryThe product category. For internal use within Campaign to organize products.
Text[1-10]Custom text fields.
Link[1-3]Product links, including link text and link URL.
Image[1-6]Product images, including the image and navigation link.
AdditionalData[1-20]Additional product data fields.

Customize data

You can modify how product entries are collected for export and customize the content of each product.
First, a market is selected (using the configured marketid in Configuration Settings). Next, catalogs are selected based on the market's default language, and products within those catalogs are collected. Because products are exported for marketing purposes, only products with a price are processed.

By default, entries under the selected catalogs are collected. To modify the list of collected products, implement IProductLoader.GetEntries().

For each product entry, a data line item is created. The basic fields in that line item are product id, name, and category. Other fields are optional. To customize that data, implement IProductFieldsHandler and override the corresponding methods.

  • PopulateCategoryFields() – Populates the category path of the product, separated by the hash symbol (#). The Campaign system can process a maximum of 10 category levels.
  • PopulateTextFields() – Populates the text values. Optimizely provides these default Text field values:
    • Text 1: product category
    • Text 2: product code
    • Text 3: product URL
    • Text 4: product unit price
    • Text 5: product discounted price
  • PopulateImageFields() – Populates image text and image link.
  • PopulateLinkFields() – Populates links.
  • PopulateAdditionalDataFields() –. Populates additional data text.