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
NoteThis only works for real-time data transmission.
- You create a custom implementation of
IOdpDataCustomizationService<T>
, which includes theGetDataCustomization
method. This method gets a filter parameter, with the following properties:- 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.
- (Coming soon) From and To – This uses
DateTimeOffet
properties to get properties within a specific time range.
- The
GetDataCustomization
method returns data in the formatIDictionary<Guid, IDictionary<string, string>>
, whereGuid
is the ID of main entity. For example, UserProfile isUserProfile.Id
.IDictionary<string, string>
is additional data where the dictionary's key is the name of a property in ODP. - This data is added to the result of a base query and sent to ODP.
Row-by-row
NoteThis only works for integration jobs.
- Create a custom postprocessor inherited from
JobPostprocessorBaseOdpExport
or a specific entity postprocessor, such asJobPostprocessorUserProfileOdpExport
. - Override the following methods:
-
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 storesUserProfile.Id
tocustomer_id
, soGetCustomizedDataKey
should return"customer_id"
. -
GetAdditionalColumnNames()
– Returns an array of strings, which represent the name of custom properties in ODP. -
GetAdditionalDataFactory()
– Returns a delegate type (factory method) that represents a method which takes aGuid
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. IfGetAdditionalColumnNames
returns["prop1", "prop2"]
, factory should return[value for prop1, value for prop2]
.
-
- Create a factory method using one of two options:
- Load all the data.
- Find data for the current row by ID.
- Return the data from the previous step. Or
- Get data from the database for each row.
- 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.
Updated 1 day ago