Dev Guide
Dev GuideUser GuidesLegal TermsGitHubDevCommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Schema modules

Map data from an external system to Optimizely Data Platform (ODP).

Optimizely Connect Platform (OCP) apps display in the Optimizely Data Platform (ODP) App Directory, which provides a list of pre-defined app categories for filtering. For more information on available app categories, see the app.yml documentation.

ODP determines the default schema (objects and fields) available to clients based on the category of apps they have installed. Some app categories have specific modules associated with them. If you choose a category for your app in the app.yml file that has a module associated with it, Optimizely Connect Platform (OCP) creates all those fields upon installation. For example, if a user installs a Loyalty & Rewards app, they will see the default schema (objects and fields) for that type of app in their ODP account. For more information on viewing objects and fields for an ODP account, see Review data fields.

📘

Note

When mapping data from an external system to Optimizely Data Platform (ODP), map to standard schema whenever possible.

Below are app categories that have modules associated with them. If you choose one of these categories for your app, make sure you use the standard schema defined below when possible.

Loyalty & Rewards module

Customers

name: customers
fields:
  - name: loyalty_points_balance
    type: number
    display_name: Loyalty Points Balance
    description: The number of loyalty points that the customer currently has.
  - name: loyalty_referral_code_id
    type: string
    display_name: Loyalty Referral Code ID
    description: The unique Referral Code ID assigned to the customer.
  - name: loyalty_tier_id
    type: string
    display_name: Loyalty Tier ID
    description: The ID of the Loyalty Tier that the customer is associated with.
  - name: loyalty_profile_created_at
    type: ts
    display_name: Loyalty Profile Created At
    description: The date and time that the customer record was created in the connected loyalty app.
  - name: loyalty_profile_updated_at
    type: ts
    display_name: Loyalty Profile Updated At
    description: The date and time that the customer record was last updated in the connected loyalty app.
  - name: loyalty_is_enrolled_member
    type: boolean
    display_name: Loyalty Is Enrolled Member
    description: If true, the customer is currently enrolled in your loyalty program.
relations:
  - name: loyalty_referral_code
    display_name: Loyalty Referral Code
    child_object: loyalty_referral_codes
    join_fields:
      - parent: loyalty_referral_code_id
        child: loyalty_referral_code_id
  - name: loyalty_tier
    display_name: Loyalty Tier
    child_object: loyalty_tiers
    join_fields:
      - parent: loyalty_tier_id
        child: loyalty_tier_id

Events

name: events
fields:
  - name: previous_loyalty_tier_id
    display_name: Previous Loyalty Tier ID
    type: string
    description: The ID of the tier with which the customer was previously associated.
  - name: current_loyalty_tier_id
    display_name: Current Loyalty Tier ID
    type: string
    description: current_loyalty_tier_id
  - name: previous_loyalty_points_balance
    display_name: Previous Loyalty Points Balance
    type: number
    description: The loyalty points balance of the customer before this event.
  - name: current_loyalty_points_balance
    display_name: Current Loyalty Points Balance
    type: number
    description: The loyalty points balance of the customer after this event.
  - name: loyalty_change_in_points
    display_name: Loyalty Change In Points
    type: number
    description: The total change in loyalty points due to this event.
  - name: loyalty_referral_code_id
    display_name: Loyalty Referral Code ID
    type: string
    description: The unique referral code to which this event applies.
  - name: loyalty_referred_customer_email
    display_name: Loyalty Referred Customer Email
    type: string
    description: The email of the customer that was referred.
relations:
  - name: loyalty_referral_code
    display_name: Loyalty Referral Code
    child_object: loyalty_referral_codes
    join_fields:
      parent: loyalty_referral_code_id
      child: loyalty_referral_code_id
  - name: previous_loyalty_tier
    display_name: Previous Loyalty Tier
    child_object: loyalty_tiers
    join_fields:
      parent: previous_loyalty_tier_id
      child: loyalty_tier_id
  - name: current_loyalty_tier
    display_name: Current Loyalty Tier
    child_object: loyalty_tiers
    join_fields:
      parent: current_loyalty_tier_id
      child: loyalty_tier_id

Loyalty referral codes

name: loyalty_referral_codes
display_name: Loyalty Referral Codes
alias: loyalty_referral_code
fields:
  - name: loyalty_referral_code_id
    display_name: Loyalty Referral Code ID
    type: string
    description: The unique referral code assigned to a customer.
  - name: referral_url
    display_name: Referral URL
    type: string
    description: The unique referral code URL.
  - name: total_shares
    display_name: Total Shares
    type: number
    description: The number of times that this referral code has been shared.
  - name: total_clicks
    display_name: Total Clicks
    type: number
    description: The total number of clicks of the shared referral code URL.
  - name: order_conversions_count
    display_name: Order Conversions Count
    type: number
    description: The number of orders that have resulted from this referral code.
  - name: order_conversions_amount
    display_name: Order Conversions Amount
    type: number
    description: The dollar amount of the number of orders that have resulted from this referral code.
  - name: expiration_ts
    display_name: Expiration Date & Time
    type: ts
    description: The date & time that the referral code expires (if it does).
  - name: is_expired
    display_name: Is Expired
    type: boolean
    description: Determines whether or not the referral code is expired.

Loyalty tiers

name: loyalty_tiers
display_name: Loyalty Tiers
alias: loyalty_tier
fields:
  - name: loyalty_tier_id
    display_name: Loyalty Tier ID
    type: string
    description:  The unique identifier for a Loyalty Tier.
  - name: name
    display_name: Name
    type: string
    description: The name of the Loyalty Tier.
  - name: description
    display_name: Description
    type: string
    description: A description of this Loyalty Tier.
  - name: rank
    display_name: Rank
    type: number
    description: The numeric rank of this Loyalty Tier relative to other Loyalty Tiers.
  - name: required_dollar_spend
    display_name: Required Dollar Spend
    type: number
    description: The amount of dollars that a customer is required to spend to reach this Loyalty Tier.
  - name: required_points
    display_name: Required Points
    type: number
    description: The number of points required to reach this Loyalty Tier.
  - name: required_purchases
    display_name: Required Purchases
    type: number
    description: The number of purchases required to reach this Loyalty Tier.
  - name: data_source_type
    display_name: "Loyalty Tier Source: Type"
    type: string
    description: The categorization of the source that updated this record. Examples include csv, app, campaign, zaius, sdk, api.
  - name: data_source
    display_name: Loyalty Tier Source
    type: string
    description: The source of the update for this record. For example, the ID of the app or the filename of the CSV. 
  - name: data_source_instance
    display_name: "Loyalty Tier Source: Instance"
    type: string
    description: The unique namespace for the provided source. For example, a store name in Shopify or a company name in Zendesk. This allows multiple versions of the same app to be installed.
  - name: data_source_version
    display_name: "Loyalty Tier Source: Version"
    type: string
    description: If the source of the update has an associated version, the version is included in this field. 
  - name: data_source_details
    display_name: "Loyalty Tier Source: Details"
    type: string
    description: "Additional details about the source."

Reviews & Ratings module

Events

name: events
fields:
  - name: product_review_id
    type: string
    display_name: Product Review ID
    description: The ID of the review relevant to this event (for product reviews).
  - name: product_question_id
    type: string
    display_name: Product Question ID
    description: The ID of the question relevant to this event (for product Q&As).
  - name: product_answer_id
    type: string
    display_name: Product Answer ID
    description: The ID of the answer relevant to this event (for product Q&As).
relations:
  - name: product_review
    display_name: Product Review
    child_object: product_reviews
    join_fields:
      - parent: product_review_id
        child: review_id
  - name: product_question
    display_name: Product Question
    child_object: product_questions
    join_fields:
      - parent: product_question_id
        child: question_id
  - name: product_answer
    display_name: Product Answer
    child_object: product_answers
    join_fields:
      - parent: product_answer_id
        child: answer_id

Product answers

name: product_answers
display_name: Product Answers
alias: product_answer
fields:
  - name: answer_id
    type: string
    display_name: Answer ID 
    description: The unique ID for this answer.
    primary: true
  - name: product_id
    type: string
    display_name: Product ID
    description: The ID of the product to which this answer relates.
  - name: question_id
    type: string
    display_name: Question ID 
    description: The ID of the question to which this answer relates.
  - name: from_store_owner
    type: boolean
    display_name: From Store Owner?
    description: Whether this answer was provided by the actual store owner.
  - name: verified
    type: boolean
    display_name: Verified?
    description: Whether this answer was left by a verified buyer.
  - name: content
    type: string
    display_name: Content
    description: The overall answer content.
  - name: visible
    type: boolean
    display_name: Visible?
    description: Whether this answer can be seen on the site.
  - name: created_at
    type: timestamp
    display_name: Creation Date
    description: The date and time when this answer was submitted.
  - name: positive_reaction_count
    type: number
    display_name: Positive Reaction Count
    description: The number of users who rated this answer positively.
  - name: negative_reaction_count
    type: number
    display_name: Negative Reaction Count
    description: The number of users who rated this answer negatively.
relations:
  - name: product
    display_name: Product
    child_object: products
    join_fields:
      - parent: product_id
        child: product_id
  - name: product_question
    display_name: Product Question
    child_object: product_questions
    join_fields:
      - parent: question_id
        child: question_id

Product questions

name: product_questions
display_name: Product Questions
alias: product_question
fields:
  - name: question_id
    type: string
    display_name: Question ID
    description: The unique ID for this question.
    primary: true
  - name: product_id
    type: string
    display_name: Product ID
    description: The ID of the queried product.
  - name: content
    type: string
    display_name: Content
    description: The overall question content.
  - name: visible
    type: boolean
    display_name: Visible?
    description: Whether this question can be seen on the site.
  - name: created_at
    type: timestamp
    display_name: Creation Date
    description: The date and time when this question was submitted.
relations:
  - name: product
    display_name: Product
    child_object: products
    join_fields:
      - parent: product_id
        child: product_id

Product reviews

name: product_reviews
display_name: Product Reviews
alias: product_review
fields:
  - name: review_id
    type: string
    display_name: Review ID
    description: A unique identifier for this review.
    primary: true
  - name: product_id
    type: string
    display_name: Product ID
    description: The ID of the reviewed product.
  - name: score
    type: number
    display_name: score
    description: The overall score represented by this review.
  - name: positive_reaction_count
    type: number
    display_name: Positive Reaction Count
    description: The number of users who rated this review positively.
  - name: negative_reaction_count
    type: number
    display_name: Negative Reaction Count
    description: The number of users who rated this review negatively.
  - name: title
    type: string
    display_name: Title
    description: The title given to this review.
  - name: content
    type: string
    display_name: Content
    description: The overall review content.
  - name: visible
    type: boolean
    display_name: Visible?
    description: Whether this review can be seen on the site.
  - name: created_at
    type: timestamp
    display_name: Creation Date
    description: The date and time when this review was submitted.
  - name: deleted
    type: boolean
    display_name: Deleted?
    description: Whether this review has been marked for deletion.
  - name: verified
    type: boolean
    display_name: Verified?
    description: Whether this review was left by a verified buyer.
  - name: top_review
    type: boolean
    display_name: Top Review?
    description: Whether this review is marked as a top review for the product.
relations:
  - name: product
    display_name: Product
    child_object: products
    join_fields:
      - parent: product_id
        child: product_id

Products

name: products
fields:
  - name: average_score
    type: number
    display_name: Average Review Score
    description: Average score of all reviews for the product.
  - name: total_reviews
    type: number
    display_name: Total Review Count
    description: Total count of reviews left for the product.
  - name: top_review_id
    type: string
    display_name: Top Review ID
    description: Unique ID of the top review identified for this product.
relations:
  - name: top_review
    display_name: Top Review
    child_object: product_reviews
    join_fields:
      - parent: top_review_id
        child: review_id

Coupon Codes module

Events

name: events
fields:
  - name: coupon_code
    type: string
    display_name: Coupon Code
    description: The coupon code associated with this event.
relations:
  - name: coupon
    display_name: Coupon
    child_object: assigned_coupons
    join_fields:
      - parent: coupon_code
        child: coupon_code

Coupon rules

name: coupon_rules
display_name: Coupon Rules
alias: coupon_rule
description: You can associate coupon codes with a coupon rule. These rules describe what the coupon code can do when used by a customer. For example, a coupon code of SUMMER20-43dha8d7vb may be associated with a coupon rule of SUMMER20.
fields:
  - name: coupon_rule_id
    type: string
    display_name: Coupon Rule ID
    description: The unique ID for this coupon rule.
    primary: true
  - name: name
    type: string
    display_name: Name
    description: A user-friendly name identifying the sale/occasion when you might offer this rule (for example, SUMMER2020).
  - name: discount_percent
    type: number
    display_name: Percent Off
    description: The amount of the discount in percentage points. For example, "5% off" is represented as 5.
  - name: discount_value
    type: number
    display_name: Value Off
    description: The amount of the discount in currency. For example, "$4 off" is represented as 4.
  - name: free_shipping_type
    type: string
    display_name: Free Shipping Type
    description: Describes how the coupon affects shipping. The only accepted values are "none", "partial", or "full_order".
    valid_values:
      - none
      - partial
      - full_order
  - name: discount_type
    type: string
    display_name: Discount Type
    description: An identifier for how this discount affects an order. The only accepted values are "per_item_discount", "per_total_discount", "shipping_discount", "free_shipping", or "percentage_discount".
    valid_values:
      - per_item_discount
      - per_total_discount
      - shipping_discount
      - free_shipping
      - percentage_discount
  - name: uses_per_customer
    type: number
    display_name: Max Uses (per Customer)
    description: The number of times each coupon code that follows this rule may be redeemed.
  - name: uses_overall
    type: string
    display_name: Max Uses (all Customers)
    description: The number of times each coupon code that follows this rule can be redeemed across all customers.
  - name: starts_at
    type: timestamp
    display_name: Valid From
    description: The date at which this rule can first be used.
  - name: earned
    type: boolean
    display_name: Earned?
    description: Indicates whether or not the coupon codes following this rule are earned. Common methods include earning a loyalty tier or performing an action (for example, sharing a product on social media).
  - name: code_prefix
    type: string
    display_name: Prefix
    description: A prefix that would be found at the beginning of every coupon code using this rule.
  - name: code_suffix
    type: string
    display_name: Suffix
    description: A suffix that would be found at the end of every coupon code using this rule.

Assigned coupons

name: assigned_coupons
display_name: Assigned Coupons
alias: assigned_coupon
description: Contains all the coupons assigned to customers. Each assigned coupon is typically associated with a Coupon Rule that describes what a coupon does.
fields:
  - name: coupon_code
    type: string
    display_name: Coupon Code
    description: The unique ID for this coupon.
    primary: true
  - name: coupon_rule_id
    type: string
    display_name: Coupon Rule ID
    description: The unique ID of the coupon rule that the coupon follows.
relations:
  - name: coupon_rule
    display_name: Coupon Rule
    child_object: coupon_rules
    join_fields:
      - parent: coupon_rule_id
        child: coupon_rule_id

Content Management module

Events

name: events
relations:
  - name: page
    display_name: Page
    child_object: pages
    join_fields:
      - parent: page
        child: page

Pages

name: pages
display_name: Pages
alias: page
fields:
  - name: page
    type: string
    display_name: Page
    description: Page URL
    primary: true
  - name: created_at
    type: ts
    display_name: Created At
    description: Date page created
  - name: updated_at
    type: ts
    display_name: Updated At
    description: Date page updated
  - name: author
    type: string
    display_name: Author
    description: Author of the page
  - name: title
    type: string
    display_name: Title
    description: Title of the page
  - name: body
    type: string
    display_name: Body Text
    description: Text of the page
  - name: body_html
    type: string
    display_name: Body HTML
    description: Markup of the page
  - name: excerpt
    type: string
    display_name: Excerpt
    description: Short description of the page
  - name: meta_tags
    type: string
    display_name: Meta Tags
    description: Meta tags used to describe the page
  - name: tags
    type: string
    display_name: Tags
    description: Tags of the page
  - name: categories
    type: string
    display_name: Categories
    description: Categories of the page
  - name: slug
    type: string
    display_name: Slug
    description: Slug or handle of the page
  - name: is_live
    type: boolean
    display_name: Live
    description: Is the page currently live
  - name: image_url
    type: string
    display_name: Image URL
    description: Primary image on page for thumbnails