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

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Send custom properties to ODP

How to send custom properties to Optimizely Data Platform (ODP) from Optimizely Configured Commerce

Optimizely Configured Commerce has two ways to send data to Optimizely Data Platform (ODP): real-time data transmission and integration jobs.

How sending data works

Real-time data

In Configured Commerce, real-time data transmission collects IDs that signify real-time changes within the system. A SQL query is executed for these specified IDs to gather the pertinent data. The results of this SQL query may differ as the structure of job data can vary slightly from real-time data. After processing, the data is transmitted to the ODP API for data handling and integration.

Integration jobs

This method starts with an SQL request to extract all necessary data from the system. The extracted data is then converted into a CSV file format. The final step sends this CSV file to an Amazon S3 bucket, where it is securely stored and available for further integration processes.

Send customized data to ODP

Configured Commerce has two options for customized data: full and row-by-row.

Full

📘

Note

This only works for real-time data transmission.

  1. You create a custom implementation of IOdpDataCustomizationService<T>, which includes the GetDataCustomization method. This method gets a filter parameter, with the following properties:
    1. IdFilter – This lets you get IDs for a specific property, instead of all data. For example, you could get custom properties only for UserProfile with a provided ID.
    2. (Coming soon) From and To – This uses DateTimeOffet properties to get properties within a specific time range.
  2. The GetDataCustomization method returns data in the format IDictionary<Guid, IDictionary<string, string>>, where Guid is the ID of main entity. For example, UserProfile is UserProfile.Id. IDictionary<string, string> is additional data where the dictionary's key is the name of a property in ODP.
  3. This data is added to the result of a base query and sent to ODP.

Row-by-row

📘

Note

This only works for integration jobs.

  1. Create a custom postprocessor inherited from JobPostprocessorBaseOdpExport or a specific entity postprocessor, such as JobPostprocessorUserProfileOdpExport.
  2. Override the following methods:
    1. GetCustomizedDataKey() – Returns the string that represents the name of a property from the base query that is equal to the ID of the main entity. For example, UserProfile stores UserProfile.Id to customer_id, so GetCustomizedDataKey should return "customer_id".

    2. GetAdditionalColumnNames() – Returns an array of strings, which represent the name of custom properties in ODP.

    3. GetAdditionalDataFactory() – Returns a delegate type (factory method) that represents a method which takes a Guid and returns an array of objects that represent the values of custom properties for the current entity with the provided ID.

      The order of strings from GetAdditionalColumnNames and objects from factory method should be the same. If GetAdditionalColumnNames returns ["prop1", "prop2"], factory should return [value for prop1, value for prop2].

  3. Create a factory method using one of two options:
    1. Load all the data.
    2. Find data for the current row by ID.
    3. Return the data from the previous step. Or
    4. Get data from the database for each row.
    5. Return the data.

Important considerations

  • Loading all data increase memory usage, but the time taken is reduced because Configured Commerce only does one request to the database.
  • Loading data for each row does not use additional memory but increases the job time execution because each row requires a request to the database.