SAP Hybris Profile

Overview

SAP Hybris Profile allows businesses to create, maintain, and continually extend customer profiles from a range of data sources. The SAP Hybris Profile platform is extensible and leverages a schema-less, flexible data structure to allow you to capture new data and insights to enrich and extend customer profiles. Consuming applications benefit from rich, contextually consistent, and relevant representations of customers that evolve over time.

SAP Hybris Profile works with SAP Hybris solutions and beyond. Starting with SAP Hybris Commerce and SAP Hybris Marketing Cloud, the connectivity will grow with innovations from the SAP Hybris ecosystem and our partners. Capturing context across all these systems of engagement supports consistently relevant experiences.

The current release version of SAP Hybris Profile focuses on the web channel, which means that it captures and processes either data coming from any website (captured using Profile's own tagging solution, Profile Tag), or clickstream and commerce data coming from an Enterprise Commerce Platform (ECP) — SAP Hybris Commerce. The following image illustrates the different types of data sources used when you extend SAP Hybris Profile on a project basis. In addition, you can extend SAP Hybris Profile to process any data, also coming from other channels or systems.

Customer Profile Overview

A customer profile is a collection of factual attributes, observations, conclusions, and classifications about a customer. You can derive this information from customer interactions with a brand. The customer profile can also include all business transactions in relation to that brand. Further details regarding the Profile data model and attributes can be found here.

Business benefits of using SAP Hybris Profile

Using SAP Hybris Profile entails various business benefits, including:

  • Improved identification of customers across different websites and channels, both for anonymous and registered users, resulting in the improved ability to communicate with precision and consistency
  • Real-time context and insights into individual customer behavior, allowing for the targeting of customers and the personalization of their profiles in a more relevant manner, based on individual real time data, leading to higher take rates and improved customer experience
  • Insights into audience behavior within the context of channel, content, and location, allowing for improved planning and the optimization of our customer engagement strategy


Use cases

SAP Hybris Profile is not a system of engagement in itself, but adds customer identity and deeper context to front office applications, where out-of-the-box integration exists, including SAP Hybris Commerce and SAP Hybris Marketing. The following use cases indicate how SAP Hybris Profile actively supports a data-driven customer experience across applications and channels.

Use cases for commerce

  • Anonymous visitor tracking: create a cross-site interest profile, which grows with each recurring visit. Leverage this profile to personalize the purchase journey from initial landing page to conversion.

  • Optimize conversion: understand current customer insight, and react to apparent changes during sessions in real time. Track the purchase journey across multiple sessions and apply Commerce Personalization, Search and Promotion tools to drive the conversion.

  • Improve personalization: use insights on long term consumer behavior and preferences (brands, products, purchase patterns) to optimize your personalization strategy.

  • Personalized guided selling: expose the customer profile within Assisted Selling Module (ASM) to enable the customer representative to fully personalize the engagement with the customer.

Use cases for marketing

  • Track interactions: track every visitor interaction across multiple content types and locations to identify interactions with all content for every visitor. Feed this data into SAP Hybris Marketing as rich content for segmentation, scoring and recommendations.

  • Score interactions: Only feed customers who meet a quality threshold into marketing for action. Trigger directly relevant actions in SAP Hybris Marketing as they happen.

Use cases for analytics

  • Track, measure, and aggregate visitor activity and content engagement across multiple content types, locations and channels in real time. Show aggregated information on a real-time dashboard. Integrate into your analytics platform of choice through our real-time query API.


Data Journey

How Profile works is best illustrated by overviewing the data flow model for this solution. The following picture explains the steps that are relevant in this context:

SAP Hybris Data Journey

Data capturing: Incoming data that contributes to a profile is called context. Profile generally supports capturing context from both streaming data and transactional data sources. For web clickstreams, SAP Hybris Profile provides a dedicated tagging solution called Profile Tag. Profile Tag allows easy mapping of web events for both commerce sites and regular web sites to Profile’s extendable event data model. For transactional data, the pre-built integration with SAP Hybris Commerce allows the capture of all customer master and commerce transactional data with minimal effort. In addition, you can extend the existing data model and API endpoints to support third-party data sources as required.

Identity management: SAP Hybris Profile focuses on identifying customers from their first interaction with a brand, which applies both to anonymous identities, on the basis of web cookies, and known identities, based on customer login. After the system processes context, the context is attributed to an existing profile if the system can match the identity. Alternatively, the system creates a new profile. Profile identity management supports session matching, cross-site matching, and cross-device matching use cases to attribute as much context as possible to an existing customer profile. In addition, if two profiles are identified as belonging to the same customer at a later point in time, the profiles are merged into a single profile through the fully-automated Profile Merge service.

Context processing: Context processing, or enrichment, happens through the so-called enricher microservices, which analyze the context in real time and then persist it as observations, transactions, or insights in a customer profile. You can freely extend enricher logic by adding additional services as part of customizing SAP Hybris Profile for specific customer requirements. You can find further information for extending SAP Hybris Profile in the Extensibility chapter.

Consumption: After the system processes and persists context from SAP Hybris Profile, which happens instantaneously, the context can be consumed in two different ways. The Profile API allows real-time access to each customer’s individual profile. This API is well-structured according to the Profile Domain Model, and can either retrieve the entire profile document or subsections of it. In addition, SAP Hybris Profile provides the Real-time Reporting service, which allows you to query customer data on different aggregation levels, from a single event to aggregated calculations spanning multiple months or years.


Profile Domain Model

SAP Hybris Profile uses a document database to store each customer's profile, sessions, interactions, insights, and other relevant data. In contrast to traditional relational databases, a document database is one you can flexibly extend without explicitly redefining the structure of the database. This allows you to easily augment customer profiles with new data. Additionally, the document database allows you to store customer data in one place, within a single JSON document, and to retrieve all customer profile data with just a single request.

The profile document contains different sections which store different pieces of information. For example, one section might store observations, such as product views in a web shop. Another section may contain insights, such as affinities, classifications, etc.

SAP Hybris Profile Domain Model


Consent management

Customers might share personal information with a company through SAP Hybris Profile. Data privacy and responsible data management are essential to building trust between a company and its customers. Privacy encompasses not only data security and data encryption, but also a robust consent management system that allows customers to control the collection and use of their personal data.

Personal data includes:

  • Technical browser attribute and device information
  • Products viewed in a web store
  • Conclusions based on interactions in a web store
  • Location-based data, such as data derived from the IP address of the user
  • Inferred demographic data, such as hobbies and spending patterns
As a tenant, you must not process sensitive personal data in the SAP Hybris Profile system.

To address data privacy, SAP Hybris Profile allows customers to grant and revoke consent at any time. Revoking consent has these effects:

  • No more data of that type is collected about this customer. This restriction applies as soon as consent is revoked.
  • Existing data of that type, and all associated data, becomes inaccessible.

There are two ways to manage consents:

  • You can grant and revoke consents from the REST API level, using the Consent service. To learn more, see the Extensibility chapter and the Consent service documentation.
  • As an end customer, you can grant and revoke consents using the Consent Manager.


Profile components

The following picture shows the main building blocks and the main data flow of SAP Hybris Profile:

SAP Hybris Profile components

You need the following components to use, integrate and extend SAP Hybris Profile:

Profile Tag: Profile Tag is the tagging solution of SAP Hybris Profile. You can use it to tag any website in order to effortlessly capture data.

Context adapters: SAP Hybris Profile retrieves data using context adapters. The system provides pre-built context adapters, such as the Edge service, to collect clickstreams and commerce data. Additionally, you can develop and register new context adapters to receive additional data streams, for example for IoT scenarios. Data flowing through context adapters needs to follow a pre-defined schema. Context adapters process all received data as events, or context, inside SAP Hybris Profile.

Context service: The Context service is a big data cluster that stores all raw events before the system forwards them to the respective enricher microservices. Each enricher microservice can query the Context service to access all the message details (contexts) for further processing.

Enricher microservices: Enricher microservices process data which flows through a context adapter. Enrichers usually analyze the data, then persist insights and observations in the profile document. You can freely extend the enricher logic. For example, you can create additional insights for specific use cases.

Data privacy and consent management: In SAP Hybris Profile, you cannot collect or use customer data without the customer's consent. Using SAP Hybris Profile consent services, the brand or store owner exposes consent management to customers at any level of data granularity, from global control to fine-grained control of particular data types and sources. See the Consent management topic for details.

Dispatcher: Based on the schema of the context message, a dispatcher forwards the message to the respective enricher microservice.

Consent service: The Consent service manages all tenant and user-specific consents. It creates and returns consent references, which you can subsequently use for all requests and operations.

Profile service: SAP Hybris Profile provides a dedicated service to manage and retrieve profile documents. Consuming applications use the Profile service to retrieve either a full profile or selected parts of it.

Real-time Reporting service: In parallel to the regular data processing through the Context service and enricher microservices, the system sends data also to the Real-time Reporting service. The Real-time Reporting service of SAP Hybris Profile allows you to process large event streams (such as clickstreams or commerce data) in real time. Data aggregation happens continuously and allows you to query data on different aggregation levels, from raw event (single click) to aggregated calculations spanning multiple months or years. You can use the Real-time Reporting service either stand-alone or combined with enricher microservices, for example to create additional insights, such as average cart value, total order volume, referrer analysis, etc.

Identity service: The Identity service clusters all of a user's identities around a single profile. It provides service endpoints to create, read, alter, and delete identities, profiles, and their relations.


Personal Data Processing

Data protection and privacy are primary concerns within the SAP Hybris Profile system.

To ensure that companies store and process customer data in a safer and unified manner, the European Union introduced a new legal framework - the General Data Protection Regulation (GDPR). The new legislation means that citizens regain control over their personal data, and international businesses find it easier to operate in the regulatory environment of the EU. The regulation comes into force on May 25, 2018. In the context of GDPR, SAP Hybris Profile is a data processor.

In line with the GDPR provisions, SAP Hybris Profile allows you to export and remove all tenant customer data, as well as export and rectify data of a single customer. Such option is available only upon request. As a data controller, you can request your profile data in the form of a user-friendly JSON file, or any other suitable format. Moreover, the system is GDPR-compliant on the level of APIs. It is also possible to retrieve audit logs of personal data changes through the Audit Retrieval service.

To read more about the process of requesting context, consent, and profile data, as well as to see sample files, visit the dedicated documentation for:


Integration Overview

SAP Hybris Profile provides you with a number of pre-built integrations, which allow you to set up and use pre-defined scenarios with low effort. Capture and analyze customer interactions, contexts and behaviors to create a continually evolving intelligent profile, enabling a deeper understanding of your customer's motivation and intent, in real time. This enables customer facing touchpoints, like commerce and marketing, to react and interact in much more personal ways.


Integrate SAP Hybris Profile with SAP Hybris Commerce

SAP Hybris Profile provides multiple pre-built integrations into SAP Hybris Commerce, including:

Event capture

The SAP Hybris Profile integration into SAP Enterprise Commerce allows you to capture multiple interactions and commerce events from a Hybris Enterprise Commerce storefront and to process it in SAP Hybris Profile in real time. The SAP Hybris Profile integration allows the following events to be sent to SAP Hybris Profile:

  • User registration and logon events
  • List item
  • Order events
  • Order creation
  • Order shipping status
  • Complete return
  • Partial return
  • Click events collected by the Hybris Analytics AddOn
  • Category or product page views
  • Add to cart
  • Remove from cart
  • Change quantity
  • Technical data
  • User agent
  • Operating system
  • Accept-headers
  • Device type
  • Piwik ID
  • Referrer
  • Screen resolution

To find more information, see the SAP Hybris Commerce documentation.

Customer Experience (CX) Smart Edit for personalization

The integration with SAP Hybris Profile allows you to map the user data from SAP Hybris Profile to segments, and use it in the personalization process.

To learn more about the integration process, visit the Integrating Personalization with SAP Hybris Profile section.

Assisted Service Module (ASM)

Assisted Service Module (ASM) enables customer service personnel to provide real-time customer sales and service support using the same storefront across the omni-channel framework. Customer Agents can provide support using ASM in physical shoulder-to-shoulder in-store scenarios and virtual online scenarios. You can integrate ASM Additional Information Framework (ASM-AIF) with SAP Hybris Profile to support displaying personalized customer-related information to customer support agents. The integration is not provided out-of-the-box and you must set it up manually.

More information can be found at help.hybris.com.


Integrate SAP Hybris Profile with SAP Hybris Marketing

SAP Hybris Profile services for Marketing allow you to consolidate user tracks and behaviors captured by SAP Hybris Profile, and to transfer this information to SAP Hybris Marketing. SAP Hybris Marketing persists this data as Interactions and Contacts. You can further use the persisted information in the marketing processes within SAP Hybris Marketing.

The system consolidates web and commerce insights from SAP Hybris Profile on a per session basis, and publishes this data for consumption by the SAP Hybris Marketing application. During the consolidation process, the system considers both interactions followed by registration and only-unique interactions. The consolidation process starts when the web session times out. SAP Hybris Marketing includes these interactions, for example, in segmentation, scoring, campaign execution, and so on.

For information on how to integrate with:

The SAP Hybris Profile services for Marketing package includes an enricher, a microservice, and a dedicated user interface.

Hybris Marketing Consolidation enricher

This enricher aims to consolidate user interaction on a commerce website. This enricher segregates marketing-relevant events, consolidates them, and publishes them for consumption by SAP Hybris Marketing. The PubSub mechanism facilitates receiving messages and publishing them to SAP Hybris Marketing.

Hybris Marketing Consolidation enricher has a default configuration. After the session times out, this enricher retrieves data related to user activities performed during the session from SAP Hybris Profile core services. Currently, the system supports the following interaction types from SAP Hybris Marketing:

  • for non-e-commerce:

    • WEBSITE_VISIT: Visits to the website
    • WEBSITE_SEARCH: Searches on the website
    • WEBSITE_DOWNLOAD: Downloads from the website
    • WEBSITE_VIDEO: Videos viewed on the website
    • WEBSITE_REGISTRATION: Registrations at the website
  • for e-commerce:

    • SALES_ORDER: Orders completed on the e-commerce website
    • SHOP_ITEM_VIEW: Product viewed on the e-commerce website

The enricher then processes the responses received and builds the consolidated output in the format required by SAP Hybris Marketing. Finally, the enricher publishes the consolidated output to the marketing PubSub topic.

Profile Services for Marketing Configuration microservice

Use this service to configure the data sent to the SAP Hybris Marketing system from SAP Hybris Profile. This service enables you to configure fields in the payload and set filter criteria to transfer data to the SAP Hybris Marketing system. For example, configure a threshold against an interest and if the user’s interest score goes beyond the threshold, the user is transferred to SAP Hybris Marketing. You can configure these fields using the dedicated user interface as well.

To use Profile Services for Marketing, you need to subscribe to the Profile Core Services and Profile Services for Commerce packages.


Integrate SAP Hybris Profile with other systems

You can integrate SAP Hybris Profile into any third party system to:


Extensibility Overview

SAP Hybris Profile offers you several ways to extend the system. The flexibility of the microservice-based architecture allows businesses to ingest, process, and analyze data from various sources.

As a business, you can augment the SAP Hybris Profile system with custom-developed extensions that capture and interpret profile data.

If you lack an entry point for particular customer or context data, extend the product and add that entry point. For example, to add a customer's Instagram data to SAP Hybris Profile, you can write and submit a new service to collect that data. Extensions can also analyze existing data to find new patterns and draw new conclusions. For example, a new service could analyze product view history and conclude that a customer has an affinity for button-down dress shirts with stripes. Other applications can use that analysis to enhance customer service and send the customer online coupons for these types of shirts.

SAP Hybris Profile offers the following extension points to:

  • add additional data
  • process data
  • create additional insights


Introduction to enrichers and context adapters

The extensible architecture of SAP Hybris Profile relies on microservices, namely context adapters and enrichers. These extensions are responsible for fetching, processing, and analyzing data within the system. To collect rich and meaningful data about your customers, you can use the pre-developed extensions that are available in your licensed packages, or develop your own services.

For example, if you are curious about where your customers come from, what devices they use to browse your website, or which product categories are their favorites, you can retrieve such data from the enrichers, which you activate in your package. If the pre-defined set of extensions does not offer a functionality that you seek, you can always develop your own customized extension that meets all your business needs.


Data processing

This section explores the flow of data that enters the SAP Hybris Profile system.

Profile Data Flow

  1. A request enters the system through the Edge service, which forwards the request to the relevant context adapters. Context adapters optionally transform context, for instance, by normalizing address formats, before passing it to the Context service.

  2. The system dispatches an event to enrichers. Note that each request, such as a product-view event, contains a schema that is associated with a set of enrichers.
    A single schema can trigger multiple enrichers.

  3. The enricher optionally fetches additional context data. For example, it can interpret purchasing data and contemporaneous weather station data to yield new data that indicates the customer is a rainy-day shopper. The enricher can use additional data from the customer profile document during this enrichment process.

  4. The enricher calls the Profile service to persist the enriched data in the customer profile document. The Profile service writes the information about the changes in the customer profile document to the Context service, which, in turn, can trigger other enrichers.

Sections of the profile document

A dedicated enricher writes particular data to the profile document, such as a customer's identifying information, or a customer's orders. Metadata for each dedicated enricher specifies a context schema defining the request that triggers the enricher, and profile schemas defining the data that the enricher writes to the profile document. For example, the metadata specifies the following schemas for the Contact Details enricher:

  • Schema context/commerce/UserRegistered: Specifies that a user-registered event triggers this enricher
  • Schema context/commerce/UserLoggedIn: Specifies that a user-logged-in event triggers this enricher
  • Schema context/commerce/FrontendEntered: Specifies that a frontend-entered event triggers this enricher
  • Schema profiles/observations/web: Specifies that this enricher writes web-related data to the profile document
  • Schema profiles/contactDetails: Specifies that this enricher writes customer contact details data to the profile document
  • Schema profiles/addresses: Specifies that this enricher writes customer address data to the profile document

Events processed by SAP Hybris Profile

Every time you perform an action, SAP Hybris Profile gathers information and records it in your profile document. Extensions configured to react to certain events communicate with the Profile service, which saves relevant data to users' profiles. Here are the events that the SAP Hybris Profile system processes:

EventSent when...Event processing outcomeSample event sent to Edge serviceEvent outcome in the profile document
user-registereda new user registers for the storefront and provides personal dataThe Contact Details enricher saves the user's personal data to the profiles/contactDetails, profiles/addresses, and profiles/observations/web sections.Sample eventSample profile
user-logged-ina user signs in to the storefront using the created credentialsThe Contact Details enricher saves the user's personal data to the profiles/contactDetails, profiles/addresses, profiles/observations/web sections.Sample eventSample profile
frontend-entereda user enters the storefrontThe event activates the Contact Details enricher that saves information in the profiles/contactDetails and profiles/addresses sections, and the Page View enricher that saves information to the profiles/observations/web, profiles/insights, and profiles/extensions section.Sample eventSample profile
session-starteda user begins a storefront browsing sessionThe Session Data enricher writes information about the start of a session to the profiles/observations/web section, and the Device Characteristics enricher saves information to the profiles/observations/web, and profiles/userAgents sections.n/aSample profile
session-timed-outthe current session ends due to a time-outThe Session Data enricher writes the information to the profiles/observations/web section, and the Search Characteristics enricher writes to the profiles/observations/web and profiles/insights/affinities sections. The Page View enricher writes to the profiles/insights/assets section.n/aSample profile
session-idledno new events appear after the last session-timed-out eventIf a session is idle for a predefined amount of time, the Session Data enricher sends an event to the Scheduled Event service to remove all information about the session upon the lapse of the period.n/an/a
product-viewa user views details of a particular product during the current sessionThe Commerce enricher saves this data to the profiles/observations/web and profiles/insights/affinities sections. The Lightweight Masterdata enricher also saves the data to the profiles/insights/affinities section. The Page View enricher saves the data to the profiles/observations/web/ section.Sample eventSample profile
category-viewa user browses a particular category during the current sessionThe Commerce enricher saves this data to the profiles/observations/web and profiles/insights/affinities sections, and the Page View enricher saves the data to the profiles/observations/web section. The Lightweight Masterdata enricher saves the data to the profiles/insights/affinities section.Sample eventSample profile
added-to-carta user adds a product to the cartThe Commerce enricher saves this data to the profiles/observations/web section, and the Page View enricher saves the data to the profiles/observations/web/ section.Sample eventSample profile
modified-cartthe quantity of products in the cart changesThe Commerce enricher saves this data to the profiles/observations/web section, and the Page View enricher saves the data to the profiles/observations/web/ section.n/aSample profile
order-cancellationa user cancels the orderThe Commerce enricher saves this data to the profiles/transactions/orders section.Sample eventSample profile
order-createda user places a new orderThe Commerce enricher saves this data to the profiles/transactions/orders section, the Page View enricher saves the data to the profiles/observations/web section, and the Order-Statistics enricher adds the data to insights.metrics.orders section.Sample eventSample profile
order-shipment-updatethe order is shippedThe Commerce enricher saves this data to the profiles/transactions/shipments section.Sample eventSample profile
partial-returna user performs a partial returnThe Commerce enricher saves this data to the profiles/transactions/returns section.Sample eventSample profile
removed-from-carta user removes a product from the cartThe Commerce enricher saves this data to the profiles/observations/web section. It does not delete the product entry from the profile JSON but sets the quantity to 0. The Page View enricher saves the data to the profiles/observations/web section.Sample eventSample profile
returna user performs a complete returnThe Commerce enricher saves this data to the profiles/transactions/returns section, and the Order-Statistics enricher adds the data to insights.metrics.orders section.Sample eventSample profile
keyword-searcha user performs a keyword search when browsing a storefrontThe activated Search Characteristics enricher writes to the profiles/observations/web and profiles/insights/affinities sections, and the Page View enricher saves the data to the profiles/observations/web section.Sample eventSample profile


Track data in the Trace Explorer

Tracing module

By monitoring events in SAP Hybris Profile, you can gather the details about the exact time of calls between services, and the duration of specific operations. Monitor events using a tracing tool based on the Zipkin tracking system, and defined in YaaS as a Trace Explorer Builder module.

SAP Hybris Profile collects timing data from the core services and enrichers to help you identify any latency problems. For example, when a service sends a request to an enricher, it passes the information about the time of the call to the system, and you can retrieve the information later. The system also gathers information about the time the enricher receives the request, as well as when that enricher returns the processed data.

Available trace data

This data is available in the Trace Explorer:

  • The time the source service sends an outbound request
  • The time the target service receives a request
  • The time the target service responds to a request
  • The time the source service receives an inbound response

By analyzing this data, you can measure how much time a request needs to reach a given service, how long it takes that service to process the request, and how much time passes until the source service receives a response.

Track events

Each event has a unique contextTraceId attribute that you can use to track the route of the event in SAP Hybris Profile. For more details about the contextTraceId attribute, see the Context events section.

To activate event tracking across SAP Hybris Profile, include a X-B3-Sampled header with a value of 1 in your request to the Context service. If you pass this header with a value of 0, or do not include this header in your request at all, tracking is not activated.

Monitor event flow in the Trace Explorer

The Trace Explorer Builder module is part of the Profile Core Services package. Subscribe to that package to get access to the Trace Explorer.

To fetch the tracked data, follow these steps:

  1. Go to the Builder.
  2. In the left navigation menu, click Hybris Profile Developer Tools.
  3. Select the Trace Explorer module.
  4. To read the timing data about the events processed by a given enricher, go to the ENRICHER ID tab and complete the dedicated field with the ID of that enricher. Alternatively, to see which services processed that event, go to the CONTEXT TRACE ID tab and enter the id from the Context service response in the dedicated field.
  5. Click SEARCH in either of the tabs to display the visualized traces. The traces consist of the spans that symbolize the services involved in the flow, and their execution time.

Debug enrichers

Using Trace Explorer, you can monitor whether enrichers receive and process events successfully. To track the event flow, pass a X-B3-Sampled header with a value of 1 in your request to the Context service, as shown in the example. For more details, see the Track events section.

curl -X POST -H "Authorization: Bearer 022-f9d7fabb-06bb-4b42-b0c2-c7716a7ff89e" -H "consent-reference: 56bd66f8-22f3-447e-8636-51ef6c9c71c1" -H "X-B3-Sampled: 1" -H "operation: STORE" -H "schema: context/commerce/ProductView" -H "Content-Type: application/json" -d '{
    "customerId": 1122322241,
    "productId" : 11232222315,
    "action"    : "view",
    "tenant"    : "mytenant"
}' "https://api.yaas.io/hybris/profile-context/v1/mytenant/data"

The response includes the id attribute that becomes a contextTraceId of a given event flow:

{
  "id": "523dd1d0-de4d-11e6-99a8-d9bb373dc57d",
  "link": "https://api.yaas.io/hybris/profile-context/v1/mytenant/data/523dd1d0-de4d-11e6-99a8-d9bb373dc57d",
  "consentRefId": "c14cc93c-9b12-46a2-8c47-9bc504412be3"
}

To see which services processed that event, copy the id attribute, and go to the Trace Explorer Builder module. Open the CONTEXT TRACE ID tab and enter the copied id in the dedicated field, then click SEARCH

Alternatively, search the details of enricher event processing by enricherId, which equals the ID of a given Builder module. For more details, see the Create Builder module section.

Enable tracing in your storefront using the dedicated script

To enable tracing in your storefront, follow these steps:

  1. Insert the following script into the website when building your storefront.
        window.Y_TRACING = window.Y_TRACING || function () {
                (window.Y_TRACING.q = window.Y_TRACING.q || []).push(arguments);
        };
        
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = 'https://s3.amazonaws.com/blobs-yaas-storks/tracing-for-storefronts/tracing.min.js';
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
        
        window.Y_TRACING(
        {
            tenant: 'yourtenant',
            builderUrl: 'https://builder.yaas.io/',
            basePiwikUrl: 'https://api.yaas.io/hybris/profile-edge/v1/'
        });
    
    Provide the following parameters in the script:
    • tenant: Your tenant name
    • builderUrl: The URL of the Builder
    • basePiwikUrl: The URL of the Edge service
  2. Add the profileTracingDebug parameter to the storefront URL and set its value to true. Your storefront URL should look as follows: http://example.com?profileTracingDebug=true.
  3. The script inserts a X-B3-Sampled header with a value of 1 into the payload of the events that customer activity in the storefront generates. The storefront then sends the events to the Edge service.
  4. The Edge service response contains the contextTraceId that you can use in the Trace Explorer to read the traces of a given event. Additionally, a link generated on the basis of that contextTraceId appears at the top of the screen.
  5. Click the link to open the Trace Explorer, where you can view all traces for a specified contextTraceId.

Enable tracing in your storefront using the Profile Tag

You can also enable tracing in your storefront using the Profile Tag in the debug mode. To learn what the Profile Tag is, and how it works, see the Profile Tag documentation.

To trace customer activity in your storefront using the Profile Tag, follow these steps:

  1. Activate the Profile Tag debug mode by adding the profileTagDebug parameter to your storefront URL and setting the parameter to true. With this debug flag, your storefront URL should look as follows: http://example.com?profileTagDebug=true.
  2. Open your browser developer tools (for example, in Google Chrome, select the Chrome menu at the top-right of your browser window, then select Tools > Developer Tools) to view the details available only in debug mode, such as tenant name and contextTraceId, associated with events that customer activity generates.
  3. Copy the contextTraceId from your developer tool.
  4. Open the Trace Explorer in the Builder.
  5. Paste the copied contextTraceId into the dedicated field in the CONTEXT TRACE ID tab.
  6. Click SEARCH to see the traces for a specified event.

Trace logs

To read the data about the events that a given enricher processes, go to the Trace Explorer Builder module and open the ENRICHER ID tab. In the dedicated field, enter the ID of the Builder module that the enricher is registered as, and click SEARCH.

The traces that the Trace Explorer displays consist of spans that indicate how much time each service needed to process a given message.

One contextTraceId identifies a full, single event flow. In this case, the event flow is the route from the Context service through an enricher and the Profile service, back to the Context service. An event from the Context service triggers an enricher. The enricher introduces changes to the profile document, which results in a new event that triggers another enricher. A single contextTraceId identifies this cycle. When changes the enricher makes in the Profile service result in a new event that triggers another enricher, a new event flow with a new contextTraceId begins. This is when a Context Transition takes place.

By displaying contextTraceId attributes in the Context Transition UI element, Trace Explorer shows how many event flows a given enricher was involved in.

Apart from the contextTraceId values, the Trace Explorer also displays schemas associated with each contextTraceId that stands for a given event flow. The schemas define events created by one enricher and triggering another enricher, and indicate where a context transition takes place.

Error scenario

The Trace Explorer helps you diagnose any event processing problems. If your enricher fails to process an event, you will see an error message in the logs. An error message indicates why the operation was not successful so that you can fix the problem.

For example, when the message indicates that you do not have a consent for a given schema, go to the Consent service to resolve the issue.


Metadata management

The metamodel is a graph database within the SAP Hybris Profile system that persists metadata describing service functions and relationships. See the Enricher Authorization service for details about how to register, view, and manage service metadata in the metamodel.

Context adapter metadata

Each context adapter registers writesTo metadata in the metamodel that describes its generated context events. The following metamodel registration entry specifies that the Piwik context adapter generates context/commerce/FrontendEntered events that are encrypted at the user level:

{
  "name": "Piwik Context Adapter",
  "writesTo": [
    {
      "schema": "context/commerce/FrontendEntered",
      "schemaTitle": "FrontendEntered",
      "schemaDescription": "Customer entered shop",
      "consentClass": "Observations",
      "searchable": false,
      "encryptionType": "user"
    }
  ]  
}    

Enricher metadata

Each enricher registers two types of schemas in the metamodel:

  • triggeredBy: The schemas defining the context events that trigger the enricher
  • writesTo: The schemas defining the data structures that each enricher writes to the profile document

This example illustrates a registration entry in the metamodel for an enricher triggered by, among others, Piwik events. The enricher writes observations (observations), contact details (contactDetails), and address (addresses) data to the database:

{
  "name": "Contact details enricher",
  "triggeredBy": [
    "context/commerce/UserRegistered",
    "context/commerce/UserLoggedIn",
    "context/commerce/FrontendEntered"
  ],
  "writesTo": [
    {
      "schema": "profiles/observations",
      "schemaTitle": "Observations",
      "schemaDescription": "Section to store the profile-relevant observations.",
      "consentClass": "Observations",
      "encryptionType": "user"
    },
    {
      "schema": "profiles/contactDetails",
      "schemaTitle": "ContactDetails",
      "schemaDescription": "Section to store information about this profile contact details.",
      "consentClass": "ContactDetails",
      "encryptionType": "user"
    },
    {
      "schema": "profiles/addresses",
      "schemaTitle": "Addresses",
      "schemaDescription": "Section to store information about this profile addresses.",
      "consentClass": "Addresses",
      "encryptionType": "user"
    }
  ]
}

Modify the metamodel event flow

Because the metamodel stores data in a form of a graph that you can arbitrarily alter and extend, the relationships among data in the metamodel are not fixed, and you can significantly alter these relationships by changing the metamodel data structure.

The modification of the data flow can be different for each tenant.

Subscribing to new enrichers and context adapters, as well as unsubscribing from pre-existing enrichers and context adapters, changes data-flow pathways in the system. Adding or removing enrichers in the metamodel might cause the other enrichers that exist within a project to either initiate or cease communication with one another. As a result, the data flow that an event triggers can follow a new route.

This diagram illustrates the data flow definition in the metamodel: Enricher 1 writes to Schema 1, which in turn triggers Enricher 2 to write to Schema 2.

graph LR A[Enricher 1] --WRITES_TO--> B((Schema 1)) B --TRIGGERS--> C[Enricher 2] C --WRITES_TO--> E((Schema 2))

Consider a scenario in which you add a new enricher to the metamodel. The new enricher writes a type of data similar to that of Enricher 2 in the diagram. If the client prefers the newly-added enricher because it is more efficient than Enricher 2, you can direct the data towards, and process it through, the new enricher instead of the original.

In this scenario, Enricher 2.1 is added to the metamodel so that it replaces Enricher 2's functionality. Note the change of the data flow.

graph LR A[Enricher 1] --WRITES_TO--> B((Schema 1)) B -.-> C[Enricher 2] B ==TRIGGERS==> D[Enricher 2.1] C -.-> E((Schema 2)) D ==WRITES_TO==> E((Schema 2))


Identity management

Identity resolution and identity management are key enablers for contextual marketing and commerce. They connect multiple sources of identity and customer information to support robust targeting, personalization, and addressability across touchpoints and devices. The SAP Hybris Identity service clusters all of a user's identities around a single profile. It provides service endpoints to create, read, alter, and delete identities, profiles, and their relations. With the start of each session, SAP Hybris Profile automatically creates the necessary identites and profiles.

Use cases

The following examples explain the benefits of proper identity management.

Scenario 1: Customer uses multiple devices

Assume an anonymous customer interacts with a brand without signing in, first using a mobile device and later a PC. At this point, in the beginning, the system can only create two different profiles and two different identities.

Anonymous customer with two profiles

At a later point, that customer signs in for the first time on either of the two devices. One of the profiles receives an additional identity. Then that customer uses the same login on the other device, too. Now SAP Hybris Profile knows that these two profiles are the same person.

Identified customer with two profiles

This puts SAP Hybris Profile in a position to merge these two existing profiles into one. Suppose that SAP Hybris Profile chooses the light blue profile to live on; the dark blue profile gets abandoned. The customer continues to use the PC. The interactions with the brand send events that come with consent reference B. The Identity service makes sure that these events find their way to the profile with consent reference A.

Identified customer with one merged profile

Whenever customers make changes to their consents, this affects the consent settings on all devices. Consider a customer using a mobile device to revoke consent for age estimation. Later, the same person opens the consent management page on a PC and sees that consent revoked. Such omni-channel consistency is important because it gives the customer a consistent experience across multiple platforms.

Consistent consent management

Scenario 3: Consistency at consumption

If a consuming application uses SAP Hybris Profile to obtain information on a specific user, the SAP Hybris Identity service makes sure that it does not matter how the consuming application identifies a consumer. It always returns the same profile.

Consistent profile consumption

Profile Merge

As soon as two profiles share sufficiently significant identities, for example a registration email or StrongId, the Merge service combines the two profiles into one.

For example, a customer who already has an account surfs a storefront anonymously, without signing in. Until the customer signs in, SAP Hybris Profile keeps two user profiles:

  • one connected with the customer's account
  • one for the customer's current anonymous session

The moment the customer signs in, the Merge service starts. The service makes sure that for the rest of the current session, the Profile system enriches the customer's known profile. The Merge service transfers every observation or insight from the anonymous session's profile into the existing profile. When the merge is complete, the service deletes the newer, anonymous session profile.

The service combines the profiles in these steps:

  1. The service aligns both profiles' consent settings. Only those consents that the consumer granted in both profiles' settings remain granted. In other words: as soon as a user revokes any consent settings of the two profiles, or it doesn't even exist in one of them, this consent will not be granted in the consent settings of the merged profile.
  2. The service redirects the identities, assigning each to a single prevailing profile.
  3. The service merges the profile documents, bundling all observations, insights, and so forth into one single profile. In cases where the original profiles have contradicting information, such as different affinities to the same product, the system uses the data in the chronologically older profile.

Technically, the Merge service is an enricher. The creation of IDENTIFIES edges between identity and profile nodes triggers the Merge service. If an identity node involved in the creation of an IDENTIFIES edge has one of the following combinations of values, the Merge service enricher combines the profiles.

  • identityType=sid and identityOrigin=web
  • identityType=email and identityOrigin=<arbitrary>

Profile document management for profile merge

When merging two profiles, this service carries over all of the necessary information, from the most recently-created profile to the chronologically older profile that the Profile system maintains. The profile document contains the details for both of the profile IDs supplied to the service. Afterward, the service deletes the newer profile.

Identity management for profile merge

When merging, the Merge service sends the two profile IDs to the Identity Service, which keeps the older profile ID and deletes the newer ID. The steps in this process include:

  1. The service gets all the identities associated with the newer profile ID.
  2. For all of the identities from the newer profile, the service adds a relationship from these identities to the older profile.
  3. The service deletes the newer profile, which also deletes the relations between the profile and the identities.

The Merge service combines profiles that share an identity. This section describes how the Merge service handles consent management for the merged profile.

After the Merge service combines profiles, SAP Hybris Profile maintains only the merged profile document, regardless of which profile's consent references the Profile service uses to retrieve it. The consent merge functionality uses the consent settings of the two profiles to decide on the consent settings of the merged profile. The service picks up all the consent schemas that are either absent in one or both of the consent references, or have different values. It sets these schemas to false and makes no changes to the values granted in both references.

Example

This is an example of a consent table before the merge:

Consent classProfile AProfile X
Product affinity
Category affinity
Age
Cart
.........

This is the same consent table after the merge:

Consent classProfile AProfile X
Product affinity
Category affinity
Age
Cart
.........

Query merged profiles in Real-time Reporting

Real-time Reporting provides aggregate data across the entire life of a profile, including the profiles merged with it. By specifying the Real-time Reporting profile lookup table with a column containing the profile ID, you can group a profile together with the profiles merged with it.

For details on how to use lookup tables in queries, see the Real-time Reporting lookup documentation.


Schedule Events

The purpose of event scheduling

Event scheduling allows you to plan the delivery of specific events in advance. Using this functionality, you can send events to SAP Hybris Profile after a predefined amount of time, rather than immediately.

You can enable event scheduling when writing your enricher. In the code of your enricher, define the scheduled event and its delivery time. The scheduled event enters the system no sooner than the time specified.

You must not use custom parameters saved under the core/ScheduleEvent schema to store personal or sensitive information, such as passwords and PIN codes. Storing data this way is a breach of license and is illegal, in compliance with the provisions of the General Data Protection Regulation (GDPR), applicable as of May 25, 2018.

Sample scenario

With the data scheduling functionality, you can determine when the system invokes a specified enricher logic to perform formerly defined modifications, such as subdocument additions, updates, or deletions.

For example, you can define when to remove a subdocument containing data that pertains to a particular session from a given profile document. By using event scheduling functionality, you can define a period after which a scheduled event triggers an enricher that removes this data from the profile document.

Consider the following scenario: Your enricher, Enricher 1, reacts to the SessionTimedOut event and, as a result, updates the session-related subdocument. You want to set the lifetime for the updated session data so the database stores that data for the specified amount of time only, for instance, 60 seconds. With the event scheduling functionality, you can set the delivery time of the SessionIdled event which causes another enricher, Enricher 2, to remove all previously-saved session data from the profile document. Consult the Scheduled Event service API SDK to learn how to properly set the scheduling function. The scheduled SessionIdled event enters the system no sooner than the time specified.

Enricher 1

function processEvent(event, context)
{
    var sessionIdToRemove = event.data.sessionId;
    var profileId = event.metadata.profileId;
    sdk.event.scheduleAt("context/commerce/SessionIdled", "P0DT0H0M60S", {"sessionId" : sessionIdToRemove, "profileId" : profileId});
    return true;
}

Enricher 2

function processEvent(event, context)
{
    /*
     * Extract data about session to be removed.
     * In lambda that scheduled an event we added profileId and sessionId to payload.
     */
    var sessionIdToRemove = event.data.sessionId;
    var profileId = event.data.profileId;
    sdk.logger.info("Going to remove session" + sessionIdToRemove + "from profile" + profileId);
    var profile = sdk.profile.get(profileId);
    sdk.profile.deleteProperty(profileId, "observations.web." + sessionIdToRemove, "Remove obsolete session.");
    return true;
}

Data flow

The following diagram shows how the data flows in SAP Hybris Profile if you use the event scheduling functionality.

Scheduled Event Flow

  1. As a result of prolonged customer inactivity in the storefront, the session expires, and the SessionTimedOut event enters the system.

  2. An enricher reacting to the SessionTimedOut event writes session data to the profile document, creating a new session-related subdocument. Because the enricher has also an event scheduling functionality incorporated in its logic, it calls the /{tenant}/scheduledevents endpoint in the Scheduled Event service, and schedules a SessionIdled event to send later.

  3. After the time specified in the enricher code lapses, the system releases the stored SessionIdled event.

  4. The SessionIdled event triggers an enricher that deletes data from the profile document.


Create an enricher

Create a new enricher

To easiest way to create a new enricher is to define a lambda enricher in the Enricher Workbench. Read how to proceed in the Lambda Enrichers section.

Define new schemas

If you are unable to locate the schemas that you require among the available schemas, you can define your own triggeredBy and writesTo schemas. When defining the properties of your schema, make sure to retain the standard schema format.

The properties that you need to determine when creating a new schema:

  • schemaTitle - the name of your schema
  • schemaDescription - a brief description of the scope of your schema
  • consentClass - the consent class to which your schema belongs
  • searchable - "true" or "false"; determines whether the schema is searchable
  • encryptionType - the type of encryption used to encrypt the data (tenant or user)

For details about how to register new schemas, see the Enricher Authorization service documentation.


Extension configurability

SAP Hybris Profile allows you not only to extend the system with various microservices, but also to configure those extensions according to your needs. You can change the behavior of your enrichers and context adapters more easily by adjusting the properties of the code, instead of modifying the code itself.

Use the Configuration Explorer to define some common parts of the code, routines, or even whole services, and later reuse them and run them parametrized. Benefit from creating your own sets of variables, configuring the pre-defined variables, and including them in your source code. That leads to less code, fewer bugs, and more control over the performance of your SAP Hybris Profile instance.


Getting started with lambda enrichers

To start developing your lambda enrichers, follow these steps:

  1. Go to the Builder and select your project (tenant).
  2. Click Administration > Subscribe. The YaaS Market page opens.
  3. In the YaaS Market, select the Profile Core Services private package with the version ID 58c904bb0dddc3000e1633cb and click Subscribe Now.
  4. Select your project and follow the prompts to confirm your subscription.
  5. In the left navigation menu in the Builder, click Hybris Profile Developer Tools.
  6. Go to the Enricher Workbench Builder module, and complete the required fields to start creating your lambda enricher.

The Enricher Workbench is a Builder module that allows you to create and test your own lambda enrichers. When you save your lambda enricher in the Enricher Workbench, a Builder module for your lambda enricher is automatically created.

You must not use lambda logs to store personal or sensitive information, such as passwords and PIN codes. Logging data this way is a breach of license and is illegal, in compliance with the provisions of the General Data Protection Regulation (GDPR), applicable as of May 25, 2018.

Because lambda enrichers that you can create in the Enricher Workbench are single-tenant, only the owner tenant can use them. For more details about single-tenant enrichers, see the Create a single-tenant enricher section.

For more information on how to create your lambda enricher in the Enricher Workbench, save the draft of your lambda enricher, or deploy it, see the Create your lambda enricher and Lambda enricher API sections.


Create a lambda enricher

Configure lambda enricher draft

To create your lambda enricher, go to the Builder. In the left navigation menu, click Hybris Profile Developer Tools. Select Enricher Workbench Builder module, then select + ADD NEW ENRICHER. In the CONFIGURATION tab, provide the basic information about the lambda enricher that you want to create:

  • Enricher Id: The ID of your lambda enricher. You must provide the Enricher Id if you want to save your lambda enricher as a draft, or deploy it.
  • Enricher Name: The name of your lambda enricher. This value is optional. When you choose the name for a public enricher, you cannot change it afterwards.
  • Triggering Schema: This is the schema that triggers your lambda enricher. Select a triggering schema from the drop-down list. Search by the schema name. Providing a triggering schema is optional when saving a draft, but required for deployment. When you save your lambda enricher as a draft, you can pick the triggering schema or schemas only from the schemas that already exist in the system. When you choose the triggering schema or schemas for a public enricher, you cannot change them afterwards.
Currently, external developers are not authorized to change the name, the triggeredBy schema, and the writesTo schema of the enricher. To make these changes, request permission from a system administrator, or create a support request that includes the enricher's ID and the payload in the form of a JSON file. When you submit the request, a system administrator introduces your changes.

Define triggeredBy schemas

To deploy the lambda enricher that you created, define a triggering schema. The Enricher Workbench allows you to select the triggering schema or schemas.

Select a triggering schema from amongst the schemas that are already defined in the system. It is not possible to define new triggering schemas in the Enricher Workbench.

To choose a triggering schema, browse the list of all available schemas. For more details, see the Enricher registration section. Alternatively, select a triggering schema from the drop-down list. You can search by schema name, schema description, and consent class.

If you wish to define a new schema, submit a support request to a system administrator who will register the new schema in the metamodel.

Use filters to trigger enrichers

To narrow down the triggering pattern on a schema, you can define filters which trigger the enrichers. Only a schema that meets these additional conditions, and is specified as your custom filter, triggers the particular enricher.

To select filters for each triggering schema, follow these steps:

  1. Click on the selected schema box which appears below the schema browser.
  2. Click on the CLICK TO ADD FILTERS caption.
  3. In the pop-up window, define your triggering filters.
  4. In the Operations field, insert the desired type of operation, for example STORE.
  5. In the Custom Filter field, insert a valid JSONPath expression.

    Example

    $.updatedProperties[?(@.property =~ /.*observations.web.*/i)]

    This filter only allows further events that have the operation parameter set to STORE, and the updated properties include properties stored under the observations.web.* path. The enricher listens to this particular property, irrespective of the session ID. As a result, only updates of the predominant time zone would trigger this enricher.

  1. Click SAVE to confirm your choice and close the window.
  2. In the Tracing tab, the Metadata field allows you to provide input that the system applies to your defined filter expression.

The Metadata in the Custom Filter example looks like this:

{
  "updatedProperties": ["path.to.property1", "path.to.property2"]
}

This functionality allows you to store the specification of filters in the metamodel, together with the triggering schema or schemas. You can also specify custom metadata for the message that the system writes to the Context service. The dispatcher receives the context event and your metadata. It calls the Enricher Authorization service and requests lambda enricher data together with the defined filters. Only if the metadata meets the filter criteria, the dispatcher passes the event to trigger target enrichers.

Provide lambda enricher code

After entering the basic details of your lambda enricher in the CONFIGURATION tab, proceed to the CODE tab and define the JavaScript code of your lambda enricher. For more details regarding the lambda enricher source code, see the Lambda Enricher API overview section, as well as the subsequent sections regarding Logger API SDK, Scheduled Event service API SDK, Profile service API SDK, Configuration service API SDK, Identity service API SDK, and Real-time Reporting service API SDK.


Test your lambda enricher

Test your lambda enricher

Test your lambda enricher in the TEST OPTIONS tab in the Enricher Workbench by simulating the delivery of an event to the lambda enricher.

To perform a test, provide these values:

  • Consent reference: The value represents your consent reference. You can either provide the formerly-generated consent reference, or you can generate your consent reference directly in the Enricher Workbench by clicking the GET CONSENT-REFERENCE button. The value of the consent reference for a given tenant is preserved in the browser session. Each time you generate a consent reference within a given project, the Enricher Workbench returns the same value.
  • Operation: The value determines the type of operation, for example STORE. For the list of supported operations, see the Lambda Enricher API overview section.
  • Test event: The value represents the input source event. The Enricher Workbench allows you to retrieve the details of the most recent event by clicking the GET RECENT EVENT button. You can retrieve the most recent event only if you define a triggering schema for your lambda enricher.

See the logs

If you click the SAVE & TEST button in the TEST OPTIONS tab, you can see the generated logs in the TEST RESULTS tab.


Save and deploy your lambda enricher

Save the draft

You can save the draft of your lambda enricher at any time. To save the draft, click on the SAVE button in the upper right hand corner of the screen.

Saving your lambda enricher is not equal to deploying it.

By selecting the SAVE option, you:

  • save your lambda enricher as a draft
  • trigger the automatic creation of a dedicated Builder module

Deploy your lambda enricher

If you wish to register your lambda enricher in the metamodel, click on the DEPLOY FROM DRAFT button.

By selecting the DEPLOY FROM DRAFT option, you:

  • deploy your lambda enricher
  • validate the triggering schema
  • trigger the automatic creation of a dedicated Builder module, unless you saved the enricher draft prior to the deployment of that enricher, and the dedicated Builder module for your lambda enricher already exists
  • register your lambda enricher in the metamodel
If you previously saved the draft of the lambda enricher you want to deploy, and the dedicated Builder module for that lambda enricher already exists, that Builder module does not get overwritten upon the lambda enricher deployment. Because the formerly-created Builder module might be outdated, you might encounter some issues with the scopes for your lambda enricher. Therefore, it is recommended that you delete the originally-created Builder module and crate a new one by saving the draft of your lambda enricher again, or deploying that lambda enricher.

When you introduce changes to the code of a public lambda, you can roll it out directly, omitting a redeployment. To do so, click the ROLLOUT CODE button, which is available for public lambda enrichers only. The DEPLOY FROM DRAFT button is not available for public lambda enrichers.


Monitor and trace the deployed lambda enricher

When you deploy your lambda enricher, you see additional tabs in the Enricher Workbench.

Configuration and code tabs

The DEPLOYED CONFIGURATION and DEPLOYED CODE tabs contain read-only data. Use those tabs to check the configuration and code of your deployed lambda enricher.

Monitoring & Tracing tab

From the MONITORING & TRACING tab located in the upper right-hand corner of the screen, you can detect undesired cycles, go directly to the Trace Explorer, or trace the currently deployed code.

Monitoring and tracing tools

  • Cycles information

In the lambda enricher event flow, an event can enter a cycle in which enrichers keep triggering themselves infinitely. Enricher Workbench detects such cycles and informs you when and where they occur. You can then inspect why the cycle occurs.

The most frequent reasons for cycle occurrence:
  • a lambda enricher writes to the same schema as it listens to, that is, the triggering schema is the same as the schema that the enricher uses to write to the Profile service or to schedule events,

  • you use another lambda enricher that writes to the triggering schema of the enricher where the system detects a cycle.

You can either fix the code of the lambda which causes the cycle, or ignore this state. By clicking the IGNORE CYCLE caption, you acknowledge the cycle occurrence and postpone fixing the code.

The tool shows if your lambda enricher is involved in a cycle. If the lambda is not involved in a cycle, the section displays a link to this documentation. If the lambda is in a cycle, you can examine where the trace for your lambda enricher starts, at which point it causes the cycle, and where the trace stops. Click contextTraceId to go to the Trace Explorer.

  • Execution metrics

Statistics presented in the Execution metrics section allow you to monitor whether the system runs your code successfully. These metrics, visualized with a bar chart, represent the number of successful and failed executions of your enricher in a given time period. A failed execution means that the system cannot run the code of your lambda enricher, for example, due to some network issues or runner problems.

The visualization pane also allows you to set a time window in which to analyze the metrics.

  • Production traces

To see the traces for a given lambda enricher, click the MONITORING & TRACING tab and select the SHOW IN TRACE EXPLORER caption in the Production traces section. In the pop-up window that appears, confirm redirect to the Trace Explorer, or select CANCEL to remain in the Enricher Workbench. If you are unsure how to proceed, click on the documentation link included in the pop-up window to learn more about the Trace Explorer.

Trace currently deployed code

To see the traces for a new event, click the MONITORING & TRACING tab to define the event or get a recent event, and select SEND EVENT. The system processes a given event as traceable. Click SHOW TRACE FOR RECENT EVENT to track this trace in the Trace Explorer.

For more details about the Trace Explorer, see the Track data in the Trace Explorer section.


Undeploy and delete your lambda enricher

Undeploy your lambda enricher

You can reverse the deployment of a private lambda enricher at any time. When you click the DEPLOYED toggle, you undeploy, or deactivate, your lambda enricher. This equals deleting the deployed enricher and removing it from the metamodel.

When you undeploy your enricher, its draft does not get deleted.

It is, however, not possible to undeploy a public lambda enricher.

Delete your lambda enricher

The Enricher Workbench also offers an option for deleting lambda enrichers. By clicking DELETE in the upper right-hand corner of the screen, you:

  • delete the draft of your lambda enricher
  • undeploy your enricher, which equals deleting the deployed enricher and removing it from the metamodel


SDK

Lambda enricher SDK overview

Your lambda enricher needs to provide a processEvent function:
processEvent(event, context): String.

  • event: A JavaScript object containing the following information about the event that triggered this enricher:
    • metadata A JavaScript object containing descriptive information about the triggering event.
      • tenant: A string representing the tenant for which this enricher is triggered.
      • schema: A string representing the triggering event's relative schema, for example: "context/commerce/ProductView".
      • operation: A string representing an operation performed on the schema. The supported operations are: CREATE, STORE, and DELETE.
      • profileId: The consumer profile ID associated with the triggering event.
    • data: A JavaScript object representing the triggering event's data, which originated in the Context service.
  • context: A JavaScript object containing the following information about the execution of this enricher:
    • timeout: A numeric value representing the allowed execution time of this enricher before it will be terminated.

The following objects are available in the "processEvent" function's runtime scope:

  • sdk: A service development kit object. Provides access to the Profile service access and other useful utilities. See examples for details.

The "processEvent" function can return a string containing information for debugging purposes.

Example

This example shows the source code of a lambda enricher that creates or updates a customer profile.

function processEvent(event, context) {
    // Create or update user profile data.
    var profileData = {
        observations: {
            lambda: {
                fullName: "Tony Stark",
                email: "ironman@marvel.com",
            }
        }
    };
    var profileId = event.metadata.profileId;
    sdk.logger.info('Profile ID: ' + profileId);
    sdk.profile.createOrUpdate(profileId, profileData);
}

Audit Ingestion Service API SDK

Use the following methods to record data changes and security events using the Audit Ingestion service.

Functions

Include the parameters listed after each function in your requests.

  • recordPersonalDataChange(objectId, objectType, attributes, serviceBasePath, time) : JSON records a change to personal data; for example: changing the billing address of a customer, or changing a customer's affinity to a product. Returns the response from the Audit Ingestion service unaltered.

    • objectId - The identifier of the owner of the object containing the personal data being changed. Within Hybris Profile, the profile id (event.metadata.profileId) is always a valid objectId.
      • objectType - The type of the object containing the personal data. If changing personal data in the profile service, use "profile" as the objectType, and if changing personal data in the identity service, use "identity". Other values are also acceptable if the data being modified resides in another service.
      • attributes - A list of changed attributes and associated values. Each attribute must contain at least "name" and "operation" fields, and can optionally include "value" and "oldValue" fields.
      • serviceBasePath - The base path to the service that manages the object containing the personal data being changed. Each module in the lambda enricher sdk has the property serviceBasePath, whose value can be used for this parameter. For example, if modifying personal data using the Profile service sdk, use the value of the sdk.profile.serviceBasePath property.
      • time - An optional timestamp in ISO 8601 format indicating the time at which the personal data change occurred; for example: "2017-05-13T17:30:00.52Z". If omitted, the current time will be applied.
  • recordPersonalDataChanges(changes) : JSON records multiple changes to personal data. Use this method to record many changes with a single command. Returns the response from the Audit Ingestion service unaltered.

    • changes - A list of javascript objects, each of which represents a single personal data change, with appropriate parameters for that change. For example:
        [
          {
            objectId: sdk.profile.profileId,
            objectType: "profile",
            attributes: [
              {
                name: "session.session1.resolutionSegment",
                operation: "delete"
              }
            ],
            serviceBasePath: sdk.profile.serviceBasePath
          }, {
            objectId: "8066cf85-3022-4230-8f31-ac6cbe89b8a9",
            objectType: "profile",
            attributes: [
              {
                name: "session.session1.color",
                operation: "change",
                value: "green",
                oldValue: "red"
              }
            ],
            serviceBasePath: sdk.profile.serviceBasePath,
            time: "2017-10-18T21:54:29.724Z"
          }
        ]
      
  • recordConfigurationChange(objectId, objectType, attributes, serviceBasePath, time) : JSON records a change to a configuration; for example: changing the shipment provider in an order flow, or changing project memberships. Returns the response from the Audit Ingestion service unaltered.

    • objectId - The identifier of the owner of the object containing the configuration being changed. Within Hybris Profile, the profile id (event.metadata.profileId) is always a valid objectId.
    • objectType - The type of the object containing the configuration. If changing a configuration in the profile service, use "profile" as the objectType, and if changing a configuration in the identity service, use "identity". Other values are also acceptable if the configuration being modified resides in another service.
    • attributes - A list of changed attributes and associated values. Each attribute must contain at least "name" and "operation" fields, and can optionally include "value" and "oldValue" fields.
    • serviceBasePath - The base path to the service that manages the object containing the configuration being changed. Each module in the lambda enricher sdk has the property serviceBasePath, whose value can be used for this parameter. For example, if modifying a configuration using the Real-Time Reporting service sdk, use the value of the sdk.realtimereporting.serviceBasePath property.
    • time - An optional timestamp in ISO 8601 format indicating the time at which the configuration change occurred; for example: "2017-05-13T17:30:00.52Z". If omitted, the current time will be applied.
  • recordConfigurationChanges(changes) : JSON records multiple changes to configurations. Use this method to record many changes with a single command. Returns the response from the Audit Ingestion service unaltered.

    • changes - A list of JavaScript objects, each of which represents a single configuration change, with appropriate parameters for that change. For example:
        [
          {
            objectId: event.metadata.profileId,
            objectType: "profile",
            attributes: [
              {
                name: "some.configurable.property",
                operation: "delete"
              }
            ],
            serviceBasePath: sdk.profile.serviceBasePath
          }, {
            objectId: "da4b817d-45ce-469d-bb1b-319a903f23f3",
            objectType: "profile",
            attributes: [
              {
                name: "some.configurable.property",
                operation: "change",
                value: "123",
                oldValue: "321"
              }
            ],
            serviceBasePath: sdk.profile.serviceBasePath,
            time: "2017-10-18T21:54:29.724Z"
          }
        ]
      
  • recordSecurityEvent(clientIp, message, serviceBasePath, time) : JSON records events which may impact the confidentiality, integrity, or availability of the system; for example: failed logins or failed authorization checks. Returns the response from the Audit Ingestion service unaltered.

    • clientIp - The IP address of the original client trying to access or amend personal data.
    • message - The string value describing the security event. The minimal required value is an empty string.
    • serviceBasePath - The base path to the service for which the security event occurred. Each module in the lambda enricher sdk has the property serviceBasePath, whose value can be used for this parameter. For example, if recording a security event that occurred in the Identity service, use the value of the sdk.identity.serviceBasePath property.
    • time - An optional timestamp in ISO 8601 format indicating the time at which the security event occurred; for example: "2017-05-13T17:30:00.52Z". If omitted, the current time will be applied.
  • recordSecurityEvents(events) : JSON records multiple security events. Use this method to record many security events with a single command. Returns the response from the Audit Ingestion service unaltered.

    • events - A list of JavaScript objects, each of which represents a single security event, with appropriate parameters for that event. For example:
        [
          {
            clientIp: "123.45.678.910",
            message: "Failed profile update attempt.",
            serviceBasePath: sdk.profile.serviceBasePath
          }, {
            clientIp: "109.87.654.321",
            message: "Failed identity deletion attempt.",
            serviceBasePath: sdk.identity.serviceBasePath,
            time: "2017-10-18T21:54:29.724Z"
          }
        ]
      

Example 1: Record a single audit

To record a change to a profile document, adopt the format of this simple lambda:

function processEvent(tenant, operation, schema, data, sdk) {
  // modify the profile
  var profileId = event.metadata.profileId;
  var propertyPath = "sessions.session1.resolutionSegment";
  sdk.profile.deleteProperty(profileId, propertyPath);

  // record the data change
  var attributesChanged = [{name: propertyPath, operation: "delete"}];
  var result = sdk.audit.recordPersonalDataChange(profileId, "profile", attributesChanged, sdk.profile.serviceBasePath);
  sdk.logger.info("Audit ingestion result: " + JSON.stringify(result));
}

Example 2: Record batch audits

To record multiple changes to personal data in different services, adopt the format of this example lambda:

function processEvent(tenant, operation, schema, data, sdk) {
  // modify the profile and the identity
  var profileId = event.metadata.profileId;
  var propertyPath = "sessions.session1.browser";
  sdk.profile.deleteProperty(profileId, propertyPath);
  sdk.identity.createProfileReferencesByIdentityKeyTypeAndOrigin(data.email, data.origin, "email", data.consentReference);

  // record the data changes
  var result = sdk.audit.recordPersonalDataChanges([
      {
          objectId: profileId,
          objectType: "profile",
          attributes: [
              { name: propertyPath, operation: "delete" }
          ],
          serviceBasePath: sdk.profile.serviceBasePath
      }, {
          objectId: data.email,
          objectType: "identity",
          attributes: [
              { name: "email", operation: "create", value: data.email }
          ],
          serviceBasePath: sdk.identity.serviceBasePath
      }
  ]);
  sdk.logger.info("Audit ingestion result: " + JSON.stringify(result));
}

Configuration Service API SDK

Use the following methods to communicate with the Configuration service.

Functions

Include the parameter listed after the following function in your requests.

  • getProperty(propertyKey) returns a response body consisting of the parameters key, value, secured, and version.
    • propertyKey is the property key of the variable to return.

Properties

Include the following property in your communication requests.

  • serviceBasePath: String [readonly] This is a string, containing the base path to the Configuration service, used for audit logging. See the Audit SDK documentation for more information.

    • Example 1

To read a specified, previously-set tenant's variable, use this simple lambda:

function processEvent(event, context) {
  var defaultAffinity = sdk.config.getProperty('defaultAffinity');

}  
  • Example 2

You can use variables retrieved using getProperty to abstract or automate your code. Examine this example:

function processEvent(event, context) {
  var shortTimeInterval = sdk.config.getProperty('shortTimeInteval'),
      affinityChangeValue = sdk.config.getProperty('affinityChangeValue');

    // schedule system event via EventAPI using tenant's variables:
    sdk.event.scheduleAt('nodes/commerce/Product/affinity', shortTimeInterval, affinityChangeValue)

}  

Identity Service API SDK

Use the following methods to communicate with the Identity service. Descriptions of the required parameters follow each request description.

Functions

  • getProfileReferencesByIdentityKeyTypeAndOrigin(identityKey, identityType, identityOrigin) : JSON returns all the profiles that have a relationship with the identity key, identity type, and identity origin tuple, and then returns all those profiles and a list of all identities associated with each of those profiles.

    • identityKey is an element of the tuple that specifies an identity.
    • identityOrigin is an element of the tuple that specifies an identity.
    • identityType is an element of the tuple that specifies an identity.
  • getProfileReferencesByProfileId(profileId) : JSON returns a profile that contains its related identities and other related data. As am example, given a profile with the ID profile123, the request returns all of the referenced profile's identities and data.

    • profileId is a string representing the ID of a profile.
  • getIdentitiesByIdentityKeyTypeAndOrigin(identityKey, identityType, identityOrigin) : JSON returns the identity for the given identity tuple (key + type + origin) along with all the profiles the identity is associated with.

    • identityKey is an element of the tuple that specifies an identity.
    • identityOrigin is an element of the tuple that specifies an identity.
    • identityType is an element of the tuple that specifies an identity.
  • getIdentitiesByIdentityId(identityId) : JSON returns data associated with a specific identity specified by the Identity ID.

    • identityId is the ID of the identity.
  • createProfileReferencesByIdentityKeyTypeAndOrigin(identityKey, identityType, identityOrigin, consentReference) : JSON creates a new profile using the provided identity tuple.

    • consentReference is the identifier referring to an explicit consent from the end user.
    • identityKey is an element of the tuple that specifies an identity.
    • identityOrigin is an element of the tuple that specifies an identity.
    • identityType is an element of the tuple that specifies an identity.
  • addIdentityByAttribute(profileId, identityKey, identityType, identityOrigin) : JSON adds an identity (specified by key+type+origin) to a profile. The identity that the key+type+origin (tuple) specifies is part of the query parameter sent across to the endpoint.

    • profileId is a string representing the ID of a profile.
    • identityKey is an element of the tuple that specifies an identity.
    • identityOrigin is an element of the tuple that specifies an identity.
    • identityType is an element of the tuple that specifies an identity.
  • addIdentityToIdentityId(profileId, identityId) : JSON adds the identity, specified by identityId, to the profile specified by profileId.

    • identityId is the ID of the identity.
    • profileId is a string representing the ID of a profile.
  • deleteProfileReferencesByProfileId(profileId) : JSON deletes the profile referenced by the submitted profileId, including edges that associate the profile with identities. If, as a result, any such identities have no edges, the service deletes those identities.

  • profileId is a string representing the ID of a profile.

  • deleteProfileReferencesByIdentityId(profileId, identityId) : JSON deletes only relationships between the Identity and Profile nodes. If the function deletes the last remaining relationship, it deletes the Identity node as well.

    • identityId is the ID of the identity.
    • profileId is a string representing the ID of a profile.
  • deleteIdentitiesByIdentityKeyTypeAndOrigin(identityKey, identityType, identityOrigin) : JSON deletes an identity, specified by an identity tuple (key + type + origin). Before deleting the Identity, this operation deletes all relations this identity has with any other node.

    • identityKey is an element of the tuple that specifies an identity.
    • identityOrigin is an element of the tuple that specifies an identity.
    • identityType is an element of the tuple that specifies an identity.
  • deleteIdentitiesByIdentityId(identityId) : JSON deletes an Identity node, specified by ID. It also deletes all of the Identity node's relationships.

    • identityId is the ID of the identity.

Properties

  • serviceBasePath: String [readonly] This is a string, containing the base path to the Identity service, used for audit logging. See the Audit SDK documentation for more information.

Identity service operations

The following examples show the source code of lambda enrichers that perform various operations in the Profile service.

Create a profile reference

This example shows an enricher that creates a profile reference using identity attributes.

function processEvent(tenant, operation, schema, data, sdk) {
    var identityKey = data.email;
    var identityOrigin = data.origin;
    var identityType = "email";
    var consentReference = data.consentReference;

    sdk.identity.createProfileReferencesByIdentityKeyTypeAndOrigin(identityKey, identityOrigin, identityType, consentReference);
}
Get profile references

This example shows an enricher that retrieves profile references.

function processEvent(tenant, operation, schema, data, sdk) {
    var profileId = event.metadata.profileId;
    return sdk.identity.getProfileReferencesByProfileId(profileId);
}
Delete profile references

This example shows an enricher that deletes profile references.

This example shows an enricher that deletes profile references.

function processEvent(tenant, operation, schema, data, sdk) {
    var identityKey = data.email;
    var identityOrigin = data.origin;
    var identityType = "email";

    sdk.identity.deleteIdentitiesByIdentityKeyTypeAndOrigin(identityKey, identityOrigin, identityType);
}

Logger API SDK

The Logger API SDK provides a variety of methods with which data can be logged.

You must not use lambda logs to store personal or sensitive information, such as passwords and PIN codes. Logging data this way is a breach of license and is illegal, in compliance with the provisions of the General Data Protection Regulation (GDPR), applicable as of May 25, 2018.

Lambda logs are available in the TEST RESULTS tab in the Enricher Workbench], as well as in Trace Explorer. To display them in the form of an event trace in the Trace Explorer, you must add the hybris.profile_tracing_manage scope to your lambda. If the scope is missing, the following message appears in the TEST RESULTS tab:

Received access token doesn’t contain hybris.profile_tracing_manage scope. Lambda logs will not be integrated with profile-tracing.

Both the TEST RESULTS tab in the Enricher Workbench], and the Trace Explorer can display only a limited number of lambda logs. If you program your enricher to log more data, instead of all the logs that exceed the limit, the trace includes the following message:

The limit of logs (100) have been reached. You cannot log more within single lambda enricher.
  • Example 1
function processEvent(event, context) {
  sdk.logger.debug('Some debug message here')
  sdk.logger.info('Some info message here')
  sdk.logger.warn('Some warning message here')
  sdk.logger.error('Some error message here')
  return 'result'
}  
  • Example 2
function processEvent(event, context) {
  try {
    notExisting.some.property
  }
  catch(err) {
    sdk.logger.error('Error occurred', err)
  }
  return 'result'
}

Functions

Include the parameters listed after each function in your requests.

  • debug(message, cause) generates a debug-level log message with the cause details.

    • message is a string containing a debug message.
    • cause is an optional string containing a debug message cause.
  • warn(message, cause) generates a warning-level log message with the cause details.

    • message is a string containing a warning message.
    • cause is an optional string containing a warning message cause.
  • info(message, cause) generates an information-level log message with the cause details.

    • message is a string containing an information message.
    • cause is an optional string containing an information message cause.
  • error(message, cause) generates an error-level log message with the cause details.

    • message is a string containing an error message.
    • cause is an optional string containing an error message cause.

Profile Service API SDK

To communicate with the Profile service, use the following API functions and properties.

Functions

Use these functions to communicate with the Profile service.

  • get(profileId) : JSON returns a profile document.

    • profileId is a string representing the ID of a profile.
  • get(profileId, fields) : JSON returns the selected fields of a profile document.

    • profileId is a string representing the ID of a profile.
    • fields is an array of strings with the paths to the properties returned in the response. Use a dot (.) as a separator.
  • createOrReplace(profileId, properties, processingReason) creates a new profile document, or replaces the entire existing document.

    • profileId is a string representing the ID of a profile.
    • properties is an object containing the properties of a profile document.
    • processingReason is a string representing the reason for data storing.
  • createOrUpdate(profileId, properties, processingReason) creates a profile if it does not exist. Otherwise, the function updates part of the profile defined in the properties parameter.

    • profileId is a string representing the ID of a profile.
    • properties is an object containing the properties to create or replace in a profile document.
    • processingReason is a string representing the reason for data storing.
  • setProperty(profileId, propertyPath, value, processingReason) replaces a value of a property. The value can be a map or a single JSON value.

    • profileId is a string representing the ID of a profile.
    • propertyPath is a dot-separated string representing the path to the property.
    • value is a map or a single JSON value to replace.
    • processingReason is a string representing the reason for data storing.
  • getProperty(profileId, propertyPath) : JSON returns part of a profile document from a given property path. The result can be a map or a single JSON value.

    • profileId is a string representing the ID of a profile.
    • propertyPath is a dot-separated string representing the path to the property.
  • deleteProperty(profileId, propertyPath, processingReason) deletes a property from a profile document.

    • profileId is a string representing the ID of a profile.
    • propertyPath is a dot-separated string representing the path to the property.
    • processingReason is a string representing the reason for data deletion.

Properties

Include the following properties in your communication requests.

  • profileId: String [readonly] This is the customer's profile ID associated with a current event. Use this property as the value of the profileId parameter in the functions.

  • serviceBasePath: String [readonly] This is a string, containing the base path to the Profile service, used for audit logging. See the Audit SDK documentation for more information.

Profile service operations

The following examples show the source code of lambda enrichers that perform various operations in the Profile service.

Replace a profile document

This example shows an enricher that replaces a profile document with a new profile document.

function processEvent(event, context) {
    var profileId = event.metadata.profileId;
    var profileData = {
      "sessions": {
        "session1": {
          "resolutionSegment": "HIGH",
          "affinity": {
            "color": {
              "red": {"count": 1}
            }
          }
        },
        "session2": {
          "resolutionSegment": "LOW",
          "affinity": {
            "color": {
              "blue": {"count": 2}
            }
          }
        }
      }
    };
    sdk.profile.createOrReplace(profileId, profileData);
}
Get a profile document

This example shows an enricher that retrieves a profile document.

function processEvent(event, context) {
    var profileId = event.metadata.profileId;
    return sdk.profile.get(profileId);
}
Get filtered profile documents

This example shows an enricher that gets a profile document with the specified fields.

function processEvent(event, context) {
    var profileId = event.metadata.profileId;
    var fields = ["sessions.session1.affinity.color","sessions.session2.affinity.color"];
    return sdk.profile.get(profileId, fields);
}
Create or update document properties

This example shows an enricher that updates only the selected properties of the profile document.

function processEvent(event, context) {
    var profileId = event.metadata.profileId;
    var profileData = {
      "sessions": {
        "session1": {
          "resolutionSegment": "LOW"
        },
        "session2": {
          "color": {
            "blue": {"count": 3}
          }
        }
      }
    };
    sdk.profile.createOrUpdate(profileId, profileData);
}
Set a property

This example shows an enricher that replaces a value of a property.

function processEvent(event, context) {
    var profileId = event.metadata.profileId;
    var propertyPath = "sessions.session1.resolutionSegment";
    var value = "MEDIUM";
    sdk.profile.setProperty(profileId, propertyPath, value);
}
Get a property

This example shows an enricher that gets a property.

function processEvent(event, context) {
    var profileId = event.metadata.profileId;
    var propertyPath = "sessions.session1.resolutionSegment";
    return sdk.profile.getProperty(profileId, propertyPath);
}
Delete a property

This example shows an enricher that deletes a property.

function processEvent(event, context) {
    var profileId = event.metadata.profileId;
    var propertyPath = "sessions.session1.resolutionSegment";
    sdk.profile.deleteProperty(profileId, propertyPath);
}

Real-Time Reporting Service API SDK

The Real-time Reporting API SDK is a JavaScript client for accessing the Real-time Reporting service. It is published as an internal npm package called realtime-reporting. The package includes a TypeScript definition file.

The client API is offered through the RealtimeReportingService object. You can access it in the Enricher Workbench as the realtimereporting property of the SDK:

var rtrSvc = sdk.realtimereporting

You can also instantiate the RealtimeResportingService outside of the Enricher Workbench in any JavaScript app by importing the npm package and then passing an appropriate ServiceConfig object to the RealtimeResportingService constructor.

const rtr = require("realtime-reporting");

var rtrSvc = new rtr.RealtimeReportingService({baseUrl: "http://some.yaas.url/", tenant: "myTenant", accessToken: "myOAuthToken"});

Functions

Include the parameters listed after the following functions in your requests.

  • getTables(): Array of TableDescription objects retrieves an array of TableDescription objects.

  • getTable(tableName): Table retrieves a specified Table object, containing one or more Column objects.

    • tableName is the name of the table (String).
  • query(tableName, query): Query executes a query against a specified table.

    • tableName is a string representing the name of a table.
    • query is a valid Query.
  • modifyData(tableName, modification) submits a request to either edit or delete specific events.

Properties

  • serviceBasePath: String [readonly] This is a string, containing the base path to the Real-time Reporting service, that you can use for audit logging. See the Audit SDK documentation for more information.

Code examples

The following code examples show how to use the functions listed in the previous section.

Get tenant tables

This example shows an enricher that retrieves all tables associated with the active tenant.

function processEvent(event, context) {
    return sdk.realtimereporting.getTables();
}
Get tenant table

This example shows an enricher that retrieves a specified table associated with the active tenant.

function processEvent(event, context) {
    return sdk.realtimereporting.getTable("someTableName");
}
Query table

This example shows an enricher that retrieves the results of a query targeting a specified table associated with the active tenant.

function processEvent(event, context) {
    var query = {
      "granularity": "all",
      "interval": "2017-03-02T19:00:00.000/2017-03-02T20:00:00.000",
      "aggregations": [
        {
          "type": "count_distinct",
          "name": "distinct_sessions",
          "column": "session_id"
        }
      ]
    };

    return sdk.realtimereporting.query("someTableName", query);
}

Scheduled Event Service API SDK

Use the following methods to communicate with the Scheduled Event service.

Functions

Include the parameters listed after each function in your requests.

  • sdk.event.scheduleAt(schema, at, scheduledPayload) returns a response body consisting of the parameters id, link, and consentRefId.

    • schema is a string defining the schedule target.
    • at is a string containing the date the Context service sends the scheduled event. Use the ISO-8601 format for the date. Present the value as a duration, for example, P2DT2H30M5S, or as a combination of date and time, for example, 2017-12-10T18:06:17.234Z. For the duration value, the system only supports days, hours, minutes, and seconds.
    • scheduledPayload (JSON object) is an arbitrary scheduled payload to be delivered at a given time. The service does not interpret it, it only passes the payload through and receives it again after the entire scheduled time elapses.
  • sdk.event.rescheduleAt(schema, scheduleId, at, scheduledPayload) returns a response body consisting of the parameters id, link, and consentRefId.

    • schema is a string containing a warning message.
    • scheduleId is a unique string identifier for the event. If you set the scheduleId, the system overwrites all previously-sent events containing the same scheduleId.
    • at is a string containing the date the Context service sends the scheduled event. Use the ISO-8601 format for the date. Present the value as a duration, for example, P2DT2H30M5S, or as a combination of date and time, for example, 2017-12-10T18:06:17.234Z. For the duration value, the system only supports days, hours, minutes, and seconds.
    • scheduledPayload (JSON object) is an arbitrary scheduled payload to be delivered at a given time. The service does not interpret it, it only passes the payload through and receives it again after the entire scheduled time elapses.

Properties

  • serviceBasePath: String [readonly] This property is a string, containing the base path to the Scheduled Event service, used for audit logging. See the Audit SDK documentation for more information.

    • Example 1

This example shows an enricher that schedules an event.

function processEvent(event, context) {
  sdk.event.scheduleAt("nodes/commerce/Product/affinity", "2017-12-10T18:06:17.234Z", {"affinity" : 1,23});
  sdk.event.scheduleAt("nodes/commerce/Product/addToCart", "2017-10-10T18:08:47.234Z");
}  
  • Example 2 This example shows an enricher that reschedules an event.
function processEvent(event, context) {
  sdk.event.rescheduleAt("nodes/commerce/Product/affinity", "nodes/commerce/Product/name/999", "P0DT0H0M5S", {"affinity" : 1,23})
  sdk.event.rescheduleAt("nodes/commerce/Product/affinity", "nodes/commerce/Product/name/352", "2018-03-10T11:57:53.234Z")
}  


User Interfaces Overview

You can easily handle and customize the SAP Hybris Profile microservices through intuitive user interfaces. Manage consents, configure your own variables, or trace customer activity in a user-friendly manner. Read about the available interfaces and experience the system's rich functionality in action.

The next sections describe how to access, use, and troubleshoot these user interfaces in SAP Hybris Profile:

  • Configuration Explorer
  • Consent Manager
  • Customer Consent Manager
  • Customer Profile Manager
  • Enricher Workbench
  • Extension Browser
  • Profile Explorer
  • Trace Explorer
  • Real-time Reporting Explorer
  • Real-time Reporting Metadata Editor


Configuration Explorer

The Configuration Explorer is a visual interface for the Configuration service, which is a part of the Persistence package. Using the Configuration Explorer, you can change the behavior of your extensions more easily by adjusting the properties of the code, instead of modifying the code itself. Using the Configuration Explorer means less code, fewer bugs, and more control.

Because properties are scoped to the current project to which an enricher is subscribed, only members of that project can customize the enricher's behavior. Another benefit is that you can reuse some common parts of the code, routines, or even whole services, and run them parameterized. Create your own set of variables or configure the predefined variables to include them in your source code, and use them with other extensions, such as the Builder modules.

The Configuration Explorer allows you to define tenant-level configurations only.

To find information about consuming defined properties, refer to the Configuration service documentation.

The Configuration Explorer is not intended for storing passwords or sensitive data.

Read on to learn how to access and use the Configuration Explorer.

Access the Configuration Explorer

The Configuration Explorer is a part of the SAP Hybris Profile Core Services package. When you subscribe to the SAP Hybris Profile Core Services package, the system automatically enables the Configuration Explorer for Builder projects of one tenant. Follow the instructions in the Builder documentation to subscribe to this package.

Follow these steps to access the Configuration Explorer.

  1. Open the Builder.
  2. Click your project.
  3. In the left navigation menu, click Hybris Profile Developer Tools.
  4. In the left navigation menu, click Configuration Explorer.

Use the Configuration Explorer

Use the Configuration Explorer to define, edit, or remove variables for use in other extensions.

To define a new variable, follow these steps:

  1. In the Configuration Explorer, click + variable. The Add a new variable window appears.
  2. Enter the name of your variable in the Variable Name field.
    The name of a property must must start with a letter or a number, be between one and 36 characters long, and can contain uppercase or lowercase letters, numbers, and the following characters: -, _, ., |, @.
  3. Provide the value of your variable in the field Value.
  4. Click Add to save your changes and add the newly-defined variable. The window closes automatically and a list of your variables appears.

Edit or remove variables

You can edit or remove entries at any time. To do so, use the pencil and bin icons on the right. Click the pencil icon to edit the details of your variable, or the bin icon to remove the whole entry.

Configuration Explorer elements

This image shows the elements of the Configuration Explorer interface.

Configuration Explorer


Consent Manager

SAP Hybris Profile offers its tenants a complex consent management tool. Through the Consent Manager, you can view and manage consents in the system.

Follow these steps to access the Consent Manager.

  1. Open the Builder.
  2. Click your project.
  3. In the left navigation menu, click Hybris Profile Developer Tools.
  4. In the left navigation menu, click Consent Manager.

This image shows the elements of the Consent Manager interface.

Consent Manager

Sample use cases

Consent Manager allows you to grant and revoke consents to particular schemas and to find consents required by specific extensions. You can use it to easily identify and fix consent-related problems in the system. For example, when you try to configure the system by enabling an extension and later notice in the Tracing tab of the Enricher Workbench that the extension does not work due to a missing consent, you can easily grant such consent in this interface.


Customer Consent Manager

SAP Hybris Profile provides a consent management tool through which the customer can define consents for the collection of various types of customer data. Two components provide the functionalities of the service: the Customer Consent Manager, a web application to manage user consents, and the dedicated Profile Management service to authenticate an anonymous user and to communicate with external services. The Profile Management service supports the anonymous authentication flow only.

The following sections explain the anonymous and logged-in authentication flows in greater detail, and how to access and use the Customer Consent Manager.

Anonymous session

When a customer enters a storefront for the first time, the storefront calls the Consent service to generate a new consent reference. The Consent service returns the consent reference together with a consent reference token, which the system uses to provide security in the anonymous flow of granting and revoking consents. The Consent service generates this token only once, when you create a new consent reference. You cannot request the token again so make sure you save it.

Customer-logged-in session

Upon logging to a storefront, the user is no longer anonymous. The SAP Commerce Enterprise system sends a userLoggedIn event with a consent reference assigned earlier upon registration. The system persists the consent reference in a browser cookie set by the Profile Tag. Consent references are merged after logging in, which means that many consent references point to one profile. If an anonymous user browses through a storefront and logs in at some point, the Merge service associates the consent references generated for both session with one profile. All data stored in the anonymous session remains in SAP Hybris Profile, and is available under either of the consent references due to aliasing functionality.

You can integrate the Customer Consent Manager, the service's visual user interface, with your system. To do that, build a link that consists of the consent reference, the consent reference token, and the name of your tenant, as follows:

  • for the USA: https://profile-manager.us-east.modules.yaas.io?t={tenant}&cr={consent-reference}&token={consent-reference-token}
  • for Europe: https://profile-manager.eu-central.modules.yaas.io?t={tenant}&cr={consent-reference}&token={consent-reference-token}
The requirement to create a deep link to the Customer Consent Manager poses a significant security threat. URLs can be misused to launch a man-in-the-middle attack or redirect legitimate users to malicious websites. As a result, attackers can steal users' identities or trick them into submitting confidential data. Therefore, you must be careful with typing the created deep link in the address bar. Pay particular attention to the type of transfer protocol to avoid building an unsecured, non-HTTPS link. In addition, store the consent reference token in the user's browser only and not send it anywhere other than to the Customer Consent Manager.

The Customer Consent Manager is the visual user interface for the Profile Management service. You can grant or revoke your consent to the collection of selected data, grouped into several consent classes. Consent management is available per consent class only. Greater granularity of consent management is possible through the Consent service API.

Customer Consent Manager


Customer Profile Manager

The Customer Profile Manager is an interface that shows how your profile changes in real time. Six tiles represent your favorite products and categories, interests, used devices, order statistics, and funnel level. The funnel level is the stage in the customer's journey through an internet advertising system or search system.

The Customer Profile Manager relies on the underlying Profile Management service to authenticate an anonymous user and to communicate with external services. The Profile Management service only supports the anonymous authentication flow.

The following sections explain how to access and use the Customer Profile Manager.

Integrate the Customer Profile Manager with the tenant's system

You can integrate the Customer Profile Manager with your system. To do that, build a link that consists of the consent reference, the consent reference token, and the name of your tenant, as follows:

  • for the USA: https://profile-manager.us-east.modules.yaas.io/profile?t={tenant}&cr={consent-reference}&token={consent-reference-token}
  • for Europe: https://profile-manager.eu-central.modules.yaas.io/profile?t={tenant}&cr={consent-reference}&token={consent-reference-token}
The requirement to create a deep link to the Customer Profile Manager poses a significant security threat. URLs can be misused to launch a man-in-the-middle attack or redirect legitimate users to malicious websites. As a result, attackers can steal users' identities or trick them into submitting confidential data. Therefore, you must be careful with typing the created deep link in the address bar. Pay particular attention to the type of transfer protocol to avoid building an unsecured, non-HTTPS link. In addition, store the consent reference token in the user's browser only, and do not send it anywhere other than to the Customer Profile Manager.

Display your profile using Customer Profile Manager

The Customer Profile Manager is a visual user interface that displays the current state of your profile. Whenever you browse a storefront, the Customer Profile Manager depicts your activity by adjusting the details in the presented tiles. The system visualizes all changes in the profile in real time.

Customer Profile Manager


Enricher Workbench

The Enricher Workbench is a Builder module that allows you to create and test your own lambda enrichers. The following sections describe how to access and use the Enricher Workbench.

Access the Enricher Workbench

Follow these steps to access the Enricher Workbench.

  1. Go to the Builder and select your project (tenant).
  2. Click Administration > Subscribe. The YaaS Market page opens.
  3. In the YaaS Market, select the Profile Core Services private package with the version ID 58c904bb0dddc3000e1633cb and click Subscribe Now.
  4. Select your project and follow the prompts to confirm your subscription.
  5. In the left navigation menu in the Builder, click Hybris Profile Developer Tools.
  6. Go to the Enricher Workbench Builder module, and complete the required fields to start creating your lambda enricher.

Enricher Workbench elements

This image shows the elements of the Enricher Workbench interface.

Enricher Workbench


Extension Browser

The Extension Browser is a dedicated visual interface for the Extension Subscription service. It allows you to view and manage extensions that are available in the metamodel. The following sections describe how to access and use the Extension Browser.

Access the Extension Browser

The Extension Browser is a part of the SAP Hybris Profile Core Services package. When you subscribe to the SAP Hybris Profile Core Services package, the system automatically enables the Extension Browser in your Builder project. Follow the instructions in the Builder documentation to subscribe to this package.

Follow these steps to access the Extension Browser.

  1. Open the Builder.
  2. Click your project.
  3. In the left navigation menu, click Hybris Profile Developer Tools.
  4. In the left navigation menu, click Extension Browser.

Extension Browser elements

This image shows the elements of the Extension Browser interface.

Extension Browser

The interface displays the status of your extensions.

The STATE column represents whether your extension is enabled or disabled.

The LICENSED column has three available statuses, as follows:

  • YES, when an extension is a part of your subscribed package
  • NO, when an extension is a part of an unsubscribed package
  • PRIVATE, when you are the owner of the extension
If you do not have a license for a particular extension, hover your mouse over the NO status to display a tooltip that advises you how to purchase this extension.

The DOCUMENTATION column displays a link that redirects to the relevant extension documentation. You can add this link when you register the enricher.


Profile Explorer

The system stores the SAP Hybris Profile data related to users' profiles and their storefront activity in a JSON document database, which you can browse using the Profile Explorer tool.

Read on to learn how to use, access, and troubleshoot the Profile Explorer.

Purpose

The Profile Explorer is a debugging tool to examine documents containing users' profile data, and to verify that the system stores the particular data within the expected subdocument.

Access the Profile Explorer

The Profile Explorer is a part of the Profile Core Services package. When you subscribe to the Profile Core Services package, the system automatically enables the Profile Explorer in your Builder project. Follow the instructions in the Builder documentation to subscribe to this package.

Follow these steps to access the Profile Explorer.

  1. Open the Builder.
  2. Click your project.
  3. In the left navigation menu, click Hybris Profile Developer Tools.
  4. In the left navigation menu, click Profile Explorer.

Profile Explorer elements

This image shows the elements of the Profile Explorer interface.

Profile Explorer

Sample use case

To view the data stored in a document, follow these steps:

  1. In the Profile ID field, enter the Profile ID of the targeted profile.
  2. Click the Search button.
  3. View the profile data, generated in the form of a JSON document, in the result pane beneath the search field.

As shown in the example, the search result is a JSON file. The - symbols, which precede all parameters, allow you to collapse selected portions of the data. When you collapse a subdocument, the - symbol turns into a + symbol, which allows you to expand the view again. Use the Expand all and Collapse all buttons to display or hide all data stored in the document.

Errors

Error messageExplanationPossible fixes
Cannot find a profile with the id: {your requested ID}The search cannot find a document with the profile information for the requested ID.Verify that you are using the correct value in the search field. Check whether the field contains any leading or trailing white spaces.


Profile Flyover

Profile Flyover is a visual toolbox that allows you to quickly learn how the SAP Hybris Profile system works. Use this tool with any website that incorporates the configured Profile Tag to experience basic system functionality.

Profile Flyover added to a sample website

Profile Flyover elements

The Profile Flyover component consists of the following elements:

Profile Flyover

Sample use case

When you browse a storefront, Profile Tag sends interactions to the SAP Hybris Profile system and then enrichers update your profile document. Use the Profile Flyover component to:

  • see how your profile grows and changes
  • revoke and grant consents
  • view traces that your last website interaction left in the system to diagnose potential problems

Add the Profile Flyover to a website

This section describes how to add the Profile Flyover both to an already existing website, and to a newly-developed one.

Add the Profile Flyover to an existing website

Follow these steps to add the Profile Flyover tool to an existing website:

  1. Make sure that Profile Tag is active on that website. Use a userscript manager to add this script to the website:

    (function () {
           var s = document.createElement('script');
           s.type = 'text/javascript';
           s.async = true;
           s.src = 'https://s3.amazonaws.com/profile-flyover/y-profile-flyover.js';
           var x = document.getElementsByTagName('script')[0];
           x.parentNode.insertBefore(s, x);
    })();
    
    (Y_FLYOVER = window.Y_FLYOVER || []).push({
     tenant: tenant, //Your tenant, for example 'my_yaas_project_identifier'
     env: env, //Environment. Possible values: 'US', 'EU'
     siteId: siteId //Your SAP Hybris Commerce site identifier, for example 'electronics'. If you do not use SAP Hybris Commerce, do not set this variable.
    });
    
    • If you use the Tampermonkey browser extension manager, incorporate this ready configuration to create a userscript.

      Set the @include parameter to the URL of the website where you want to activate the Profile Flyover, such as http://example.com*/electronics. Remember to set the tenant, env, and siteId parameters. If that website uses HTTPS protocol, adjust the @include parameter to reflect it.
      
      // ==UserScript==
      // @name         yProfile flyover
      // @namespace    <a href="http://tampermonkey.net/">http://tampermonkey.net/</a>
      // @version      0.1
      // @description  Component to easily debug yProfile
      // @include      http://<em>/</em>
      // @grant        none
      // ==/UserScript==
      
      (function () {
            var s = document.createElement('script');
            s.type = 'text/javascript';
            s.async = true;
            s.src = 'https:// s3.amazonaws.com/profile-flyover/y-profile-flyover.js';
            var x = document.getElementsByTagName('script')[0];
            x.parentNode.insertBefore(s, x);
      })();
      
      (Y_FLYOVER = window.Y_FLYOVER || []).push({
      tenant: tenant, //Your tenant, for example 'my_yaas_project_identifier'
      env: env, //Environment. Possible values: 'US', 'EU'
      siteId: siteId //Your SAP Hybris Commerce site identifier, for example 'electronics'. If you do not use SAP Hybris Commerce, do not set this variable.
      });
      
  2. Save the script.

  3. Open the website and start the SAP Hybris Profile experience. The system generates a fresh consent reference for you, and you can populate your profile from scratch.

Add the Profile Flyover to a newly-developed website

When you develop your own website, you can also use the Profile Flyover. To display it on your website, add the following script to your code:

  <script async src="https://s3.amazonaws.com/profile-flyover/y-profile-flyover.js"></script>


Trace Explorer

Monitoring events in SAP Hybris Profile allows you to gather the details about the exact time of calls between services, and the duration of specific operations, like an update on a profile document or a store operation in the Context service that creates a scheduled event. Browse the collected trace events using the Trace Explorer Builder module.

Use case

Tracing operations can be useful for many reasons. Let's say you schedule an event to trigger your enricher after ten seconds. However, after one minute nothing happens. The system does not perform the scheduled operation, and the profile document is not enriched with new data. The Trace Explorer allows you to verify the system's delay and to check how long does it take for an event to get from a particular service to your enricher or another service.

Access the Trace Explorer

The Trace Explorer Builder module is a part of the Profile Core Services package. Subscribe to that package to get access to the Trace Explorer.

This section describes how to access and use the Trace Explorer.

Monitor event flow in the Trace Explorer

The Trace Explorer Builder module is a part of the Profile Core Services package. Subscribe to that package to get access to the Trace Explorer.

To fetch the tracked data, follow these steps:

  1. Go to the Builder.
  2. In the left navigation menu, click Hybris Profile Developer Tools.
  3. Select the Trace Explorer module.
  4. To read the timing data about the events that a given extension processes, go to the EXTENSION ID tab and complete the Search extension id field with the ID of that extension. Alternatively, to see which services processed that event, go to the CONTEXT TRACE ID tab and enter the id from the Context service response in the Search context trace id field.
  5. Click SEARCH in either of the tabs to display the visualized traces. The traces consist of the spans that symbolize the services involved in the flow, and their execution times.

Trace Explorer elements

These images show the elements of the Trace Explorer interface.

Trace Explorer

Trace Explorer


Real-time Reporting Explorer

The Real-time Reporting service aggregates time series data across profiles. The Real-time Reporting Explorer supports the service, providing a visual sampling of this information.

Read on to learn how to access and use the Real-time Reporting Explorer.

Purpose

The Real-time Reporting Explorer provides an easy-to-use interface for visualizing the data stored in Real-time Reporting. It allows users to debug, demo, and inspect the stored data to gain valuable insights.

Access the Real-time Reporting Explorer

The Real-time Reporting Explorer is a part of the Profile Core Services package. When you subscribe to the Profile Core Services package, the system automatically enables the Explorer in your Builder project. Follow the instructions in the Builder documentation to subscribe to this package.

Follow these steps to access the Real-time Reporting Explorer:

  1. Open the Builder.
  2. Click your project.
  3. In the left navigation menu, click Hybris Profile Developer Tools.
  4. In the left navigation menu, click Real-time Reporting Explorer.

Real-time Reporting Explorer elements

Exhibit A. This image shows the elements of the explorer interface. The line charts shows event counts by 'action_name'. All distinct action names are displayed.

Real-time Reporting Explorer, Exhibit A

The drop-down lists in the left panel drive the content in the chart panel on the right. Default values are set when launching the tool.

  1. Interval Selector - This determines the interval for the queries relative to the current date.
  2. Granularity Selector - The available granularities adjust to accommodate the selected interval. Larger granularities support larger intervals.
  3. Table Selector - This lists all active tables for your tenant.
  4. Column List - This displays all columns associated with the selected table. Column selection drives the query and associated result.
  5. Aggregations - The system only supports 'Count' at this time.
  6. Result Chart - This displays a count by dimension and granularity unit for the interval selected. The system can display a line chart if a single column is selected; otherwise, the data is rendered in a grid.

Filtering

The line chart supports filtering by dimension value. Simply click the value label in the legend to toggle the inclusion of that value in the display.

Exhibit B: After you click on the 'CartUpdate' label, the system excludes the action 'CartUpdate' from the result display.

Real-time Reporting Explorer Exhibit B


Real-time Reporting Metadata Editor

The Real-time Reporting service allows you to create and modify data tables. The Real-time Reporting Metadata Editor supports the service by providing a visual means of defining the table metadata.

This document explains how to access and use the Real-time Reporting Metadata Editor.

Purpose

The Real-time Reporting Metadata Editor provides an easy-to-use interface for visualizing and defining the table metadata that drive the data storage in the Real-time Reporting service.

Access the Real-time Reporting Metadata Editor

The Real-time Reporting Metadata Editor is a part of the Profile Core Services package. When you subscribe to the Profile Core Services package, the system automatically enables the editor in your Builder project. Follow the instructions in the Builder documentation to subscribe to this package.

Follow these steps to access the Real-time Metadata Editor:

  1. Open the Builder.
  2. Click your project.
  3. In the left navigation menu, click Hybris Profile Developer Tools.
  4. In the left navigation menu, click Real-time Reporting Metadata Editor.

Real-time Reporting Metadata Editor elements

These are the elements of the Real-time Reporting Metadata Editor:

  1. Navigation bar - To save any changes to the current table's metadata, click the SAVE button. The Real-time Reporting Service persists all metadata changes for the selected table. To undo the metadata changes before saving them, click the CANCEL button. This operation removes any unsaved changes and the table reverts to its current state that the Real-time Reporting Service persists. To navigate back to the previous page within the Builder, click the BACK button.
  2. Table name drop-down - This element allows you to select an existing table. When defining a new table, use this element to define the table's name.
  3. Add table button - Click this button to define a new table and its metadata.
  4. Table description editor - This element displays the table's description and allows you to define it.
  5. Ingestion type list - This element allows you to select the table's ingestion type. You cannot modify the ingestion type of an existing table.
  6. Table status - This element displays the current status of the table.
  7. Add column button - This element displays the column metadata dialog that allows you to create a new column associated with the selected table.
  8. Column list - This element displays a read-only view of the columns associated with the selected table. Each row of the list displays the following column metadata: 8.1. Column name - This displays the name of the column. 8.2. Column type - This displays the type of the column. 8.3. Column collection checkbox - This box is checked if the column represents a collection of values. 8.4. Column path - This element displays the path that you use to populate the value of the column. 8.5. Column actions - Use the modification and deletion buttons to modify or delete the respective column.
    You cannot delete the required columns, such as guid, profile_trace_id, and the column of the timestamp type. You can modify the column of the timestamp type only.
  9. Column metadata dialog - This element displays the following table column metadata: 9.1. Column name editor - This element allows you to define the column's name. You cannot change the name of an existing column. 9.2. Column type drop-down - This element allows you to select the column's type. 9.3. Column description editor - This element allows you to define the column's description. 9.4. Column path editor - This element allows you to define the column's JSON path. 9.5. Column collection Checkbox - This element allows you to define a column as a collection.

Exhibit A. This image shows the elements of the editor interface.

Real-time Reporting Metadata Editor, Exhibit A

Create a table

When you click the Add table button, the system displays the following widgets that allow you to define the new table:

  1. Table Name - Use this element to provide a required unique name for your new table.
  2. Description - Use this element to optionally provide a description for the table.
  3. Ingestion Type - Use this element to select one of these ingestion types: clickstream, commerce and direct. Ingestion type is a required property.

When you select the ingestion type, the system populates the table with template columns specific to that ingestion type. Each template column set provides at least these mandatory columns:

  1. The guid column that you cannot delete or modify.
  2. The profile_trace_id column that you cannot delete or modify.
  3. The timestamp column. You can modify the column's name and description.

You can edit and delete any other columns.

This image shows the table creation interface.

Real-time Reporting Metadata Editor, Exhibit B


Profile Tag

Tracking consumers on web pages requires capturing data while consumers browse the site. You can usually accomplish this with a tracking pixel, or tag: code inserted into a web page that sends data to the server. In the past, tracking pixels were transparent GIF images. Now, tracking pixels are more sophisticated tags based on JavaScript.

It can be cumbersome to manually create and maintain such tags throughout a website. SAP Hybris Profile Tag simplifies tag management and data capture. Using the easy-to-use user interface, you configure the way data gets sent to SAP Hybris Profile. SAP Hybris Profile Tag offers a flexible way to adapt to the structure of your online presence, and allows you to define the events that you create by sending the information you wish to store in SAP Hybris Profile.

Profile Tag components

SAP Hybris Profile Tag consists of the following components:

  • A graphical user interface to configure the tag for your website. This includes settings on the site level, page level, and individual interaction level such as mouse click etc.
  • A JavaScript library to include in the code of your website that captures data of the page and sends it to SAP Hybris Profile during run time.

For more details about the Profile Tag components, see the Elements of Profile Tag section.

Prerequisites for Profile Tag

Profile Tag is part of the SAP Hybris Profile Core Services package and is included in the commercial subscription of SAP Hybris Profile. For a commercial subscription, please contact your account executive.

Elements of Profile Tag

  • Tag (JavaScript library): To have a web page send events to SAP Hybris Profile, introduce the Profile Tag script to that web page. This script fetches the configuration for this site and applies the appropriate configuration to the current page in order to generate and send the tracking events to SAP Hybris Profile.

  • Configuration: The goal of Profile Tag is to create and send events to SAP Hybris Profile. To send the correct events with the correct payload, each tenant has to set up a configuration which tells Profile Tag how to translate the elements of the tenant's site into the relevant service call payloads. To configure Profile Tag, a tenant uses the Profile Tag user interface. It provides means to store the configurations in, and retrieve them from, a remote storage.

    • Site: A site is a set of web pages, such as a web shop or a website, from which you can collect the data about customer interactions to build up customer profiles. A site can be any online presence which can execute JavaScript. In the most common use cases, an online shop, such as shop.example.com, uses Profile Tag. If the internal structure of the pages or privacy regulations between shop.example.com/us and shop.example.com/de differ greatly, set up two sites, one for the US version and one for the DE version.

    • Page: A site usually has many pages. A shop with 100 products most likely has a product detail page for each of these 100 products. Besides that, the site can have an "about" page, a start page, a cart page, perhaps a range of landing pages for SEM (Search Engine Marketing) or other campaigns, category pages, search result pages, and so on. The content of the 100 product pages might differ, each showing a different product, but their internal HTML structure is the same. All product pages may have similarly composed titles, header elements, add-to-cart buttons, and so on. A tenant who wants to track user behavior on one product detail page, most likely wants to track it on all 100 product detail pages. Thankfully, the tenant can easily create 1 page definition in Profile Tag, and match it to all 100 of his product-detail pages.

    • Selector: One or multiple selectors select parts of the page (or the DOM). Profile Tag sends them as part of a data collection to SAP Hybris Profile.

Mechanics of Profile Tag

When a user visits a site containing Profile Tag, Profile Tag collects and sends data to SAP Hybris Profile according to the configuration created via the Profile Tag user interface. This configuration contains one or more page definitions, which are matched to the currently rendered page based on pre-defined rules. These page definitions contain information about how Profile Tag should collect and send data to SAP Hybris Profile. A page may match zero, one, or many page definitions.

Mechanics of Profile Tag

Example

A tenant can have this configuration:

  • A page definition in the Profile Tag UI called Product Review Page. This is configured to match every page of a site where the URL contains &reviewid=.
  • The Product Review Page definition is configured with selectors specifiying which data to gather and how. For example, a selector may be created to seek the first <h1> element of the page, split its value at the : character, take the first element of the resulting array, and use it as the productSku.
  • In ProductDetailPageView event messages, this value is used as productSku.


Set up Profile Tag

Create a YaaS Client for Profile Tag

Profile Tag requires a YaaS Client to allow the script to communicate with the SAP Hybris Profile services. A tenant has to set up the YaaS Client to use it for multiple sites, pages and configurations.

To create a YaaS Client, please follow these steps:

  1. On the left hand side in the YaaS Builder main menu of your project, go to Development > Client.
  2. Click + Client.
  3. There is no need to select required scopes. Click Next.
  4. Provide an identifier and a display name. For example, the identifier can be profiletagclient and the display name can be Client for Profile Tag. You need the identifier for later, together with the project identifier.
  5. Click Save.

Create a site definition

To set up a new site in Profile Tag:

  1. On the left hand side in the YaaS Builder main menu of your project, go to Hybris Profile Developer Tools > Profile Tag.
  2. Click + ADD SITE.

Add Site

Next, specify the following details:

New Site

  • Site Name: The name of the site used in Builder. This name must be unique within your project.

  • Consent Management: This setting determines how your site deals with customer consents. Consent management can be either implicit, or explicit:

    • Implicit consent management: Customer consent is assumed (opt-out). The customer does not need to express permission. Profile Tag proactively makes requests to the profile to create new user-individual consent records with the tenant's default consent settings. Profile Tag stores and uses the records during subsequent visits.

    • Explicit consent management: Customer consent is not assumed (opt-in). The customer must express permission. At the page level, add the DOM element a user must click on in order to grant consent.

  • Site Description: Provide a more detailed explanation of the purpose of a site. It is especially helpful, if you have multiple sites. This setting is optional.

When you save your changes, you are redirected to the site management page. This page contains more data and controls than the New Site page.

Edit Site

  • Configuration URL: This is the location where the configuration of the site is stored. The tracking code you can introduce to the pages of your side requires this setting.

  • SAVE: Click this button to save the site configuration. After saving, this button shows ROLL OUT. After clicking on ROLL OUT, the Configuration URL is filled out.

  • DELETE SITE: Removes the site and its configuration. The delete operation is irreversible!

  • Pages: This area shows the list of page definitions belonging to this site. For more detail, see the Set up a New Page Definition section.

You must SAVE and ROLL OUT the changes in order for the site configuration to take effect. Click the SAVE button in the top right, and then ROLL OUT to publish.


Set up a new Page Definition

Typically, a site contains different pages that have the same or similar technical structure. Profile Tag reflects this nature as it allows you to create page definition which it can match to one or more pages within a site. For example, you can have the following page definitions:

  • Main Landing Page: This page definition covers the structure of a landing page.
  • Product Category Page: This page definition covers all product category pages, because they all have the same technical structure.
  • Product Detail Page: This page definition covers the structure of all product detail pages.

Sample scenario

In this sample scenario, your store offers 100 different products. While each product has its own product detail page with a unique URL, these 100 pages share the same technical structure (i.e. the same DOM identifiers). Therefore it is sufficient to configure a single page definition, e.g. called Product Detail Page, to enable tracking for all product detail pages offering a detailed view of a product.

If, however, a customer performs a keyword search query, the site displays a keyword search result page with a different internal structure. If you want the keyword search result pages to also collect information and send events to Profile, you need to create and configure a new page definition in the Profile Tag UI.

To create a new page definition:

  1. On the left hand side in the YaaS Builder main menu of your project, go to Hybris Profile Developer Tools > Profile Tag.
  2. Select the applicable site.
  3. Click ADD NEW PAGE in the Pages section.

New Page

Supply the following information:

  • Name: The name of the page type you create this definition for. Use the vocabulary you are used to, or find a good fit. Examples:

    • Products overview
    • Detailed_Product_View
    • Product Review Page
    • StoreSearch
    • Home
  • Description: Add a description to explain what the purpose of the page is, especially if the title is not self-explanatory. This setting is optional.

  • JavaScript variable to match against: The JavaScript variable against which to match the regular expression. This variable must be accesible via the window object, e.g. location.href is accesible via window.location.href. You can inspect these variables via the console of your browser.

  • Regular Expression: This is the pattern that Profile Tag matches against the specified JavaScript variable. Profile Tag evaluates the regular expression of each page definition during the rendering of a page. If there is a match, Profile Tag collects the corresponding data and sends it as specified by the configurations of the page definitions. If several different page definitions match the same page simultaneously. Profile Tag applies the configuration of each matching page definition. Profile Tag expects you to to define these regular expressions using standard JavaScript syntax.

Examples:

Page DefintionCharacteristics of the rendered pageJavaScript variable to match againstRegular expression
Product Detail PageThe URL of the page contains /product/location.href\/product\/
Search PageAfter clicking on the search button, the shop directs the user to shop.example.com/frenchStore/searchqueryterm?. Both http and https are possible.document.refererhttps?:\/\/shop.example.com\/frenchStore\/searchqueryterm\?
Product Detail PageA page title containing the word Details.document.titleDetails

If you want the changes to the configuration of a page definition to take effect, you must save it. Click the SAVE button on the top right corner of the screen. To publish it, click the ROLL OUT button at the site level.

If the ROLL OUT button is not visible at the site level, you need to click SAVE first.

Now that Profile Tag knows under which circumstances to match a rendered page to a page definiton, it can use the cofigurations of the page definitions to collect and send data to SAP Hybris Profile. These configurations include:

  • which data to collect and send, and if Profile Tag should modify it before sending it.
  • when Profile Tag should collect and send data.
  • which schema Profile Tag should send, thereby adding context to a user's visit.


Configure Data Collections

Data Collection Overview

Profile Tag allows a way for you to gather and transmit data to SAP Hybris Profile from pages that a user visits. SAP Hybris Profile then analyses this data to enrich the user's profile. The configuration of the page definitions, which Profile Tag matches to the currently rendered page, dictates this gathering and transmitting of data.

A page definition consists of one or more Data Collections, which you can consider as a way to gather a grouping of data that Profile Tag sends to SAP Hybris Profile along with a schema. The source of this gathered data is not limited to HTML, but can also come from a JavaScript object, a cookie, information from a DOM event, the Google Tag Manager, or can simply be a static value.

A Data Collection does not only specify which data to gather, it also defines the timing of the gathering. This happens done either during the loadinging of a page, or by specifying a DOM event that Profile Tag should listen for. Once Profile Tag gets the signal that it is time to gather data, it sends each Data Collection individually to SAP Hybris Profile.

Creating a new Data Collection

New Page

When creating a new Data Collection, you have the option of creating it based on an existing template. These templates help to make sure that Profile Tag always sends certain data for certain schemas. These schemas add some additional context around the parsed data. This ability to view the data contextually further enhances SAP Hybris Profile's ability to enrich a user's profile.

For example, to create a Data Collection based on the Category Page View template:

  1. Click on NEW (USING TEMPLATE).
  2. Click on CATEGORY PAGE VIEW.

New Page

The following is a list of the templates and their required selectors:

Schema to sendMandatory Selectors by key
context/commerce/CategoryViewproductCategory
context/commerce/ProductViewproductCategory
productName
productSku
productPrice
context/commerce/AddedToCartcartId - identifier of the visitor's shopping cart
productSku - product stock-keeping unit: the shop-wide unique identifier of the product
productQty - quantity: defaults to 1, if not set
context/commerce/RemovedFromCartcartId - identifier of the visitor's shopping cart
productSku - product stock-keeping unit: the shop-wide unique identifier of the product
context/commerce/KeywordSearchsearchTerm
productCategory
numResults
context/core/AssetDownloadStarteddownloadUrl
When creating a Data Collection based on one of these schemas, all of the listed selectors along with their proper keys are required. Changing the key of one of these selectors prevents Profile Tag of sending it.

Data Collection trigger

This is where you define when Profile Tag should gather and send the Data Collection. This may be one of the following two options:

  • On page load: Profile Tag collects the data and sends it as soon as the browser fully parsed the rendered page.
  • On user interaction: Profile Tag reacts on a DOM event either a user triggers manually or JavaScript code automatically. You need to specify a certain HTML element with this option. For example a click interaction on a #submit element tells Profile Tag to collect and send the data as soon as someone clicks on the element with the id submit. For a complete list of possible events, see the Mozilla Developer Network

profiletag-trigger

Selectors

Selectors comprise Data Collections. Selectors allow you to define data that SAP Hybris Profile Tag extracts from a website. This section explains how to add, edit, and remove selectors as well as the configurable parameters of selectors and their effects.

Create a new selector

To configure a new selector:

  1. Click + NEW SELECTOR.
  2. In the pane under the + NEW SELECTOR button, you see all of your selectors on the left-hand side. When you click on one, it is highlighted blue, and you see the fields of the selector on the right-hand side. For information on how to configure these fields, see Selector Fields for more details.
  3. Click OK in the bottom-right corner of the window. The window closes.

profiletag-new-selector

For your changes to take effect:

  1. Click SAVE in the top-right corner of the screen.
  2. Click BACK in the top-left corner of the screen.
  3. Click ROLL OUT in the top-right corner of the screen.

Selector Fields

The following fields are required for every selector:

  • Key: The key is a name that Profile Tag assignes the captured data to. See Selector Keys for more information.
  • Type: The type of a selector determines how Profile Tag interprets the captured data.

The type of selector you choose has an additional piece of required information. The following table summarizes the types of selectors along with the information required for that specific type of selector. The table uses the following HTML snippet for its examples:

<div id="demo"><a href="url">My text</a></div>
<img id="demo-image" src="www.example.com/example.png">
Type of SelectorRequired settingExample valueResultRemarks
CookieCookie namecart-idorder-23This cookie must be accessible from JavaScript, meaning it cannot be an HTTP only cookie.
Inner HTMLDOM selector#demo<a id="demo" href="url">My text</a>Includes the entire content of the DOM element, but without the opening and closing HTML tags of the DOM element.
TextDOM selector#demoMy textRemoves all HTML, including only the plain text within the DOM element.
JS VariableJS variablelocationhttp://example.comThis variable must be accessible via the global window object.
EventEventevent.pointerTypemouseThis allows you to collect information from the event which triggers the data collection. Event properties are accessible via "event.". For example, if the data collection is triggered by the "pointerdown" event, you can gather whether the device used was a mouse, pen, or touch via "event.pointerType"
ConstantValueSearchSearchThis allows you a way to always send the same value for the selector. For example, if the page definition is for a product search page, but this page also allows you to add an item to a shopping cart, then the category may not be available. In this case, you can send the constant Search as the productCategory selectory of the add to cart event, thereby signalling that the product was found via a search.
DOM elementDOM selector#demo-image<img id="demo-image" src="www.example.com/example.png">Includes the entire content of the DOM element, as well as the opening and closing HTML tags of the DOM element.
DOM elementAttributesrcwww.example.com/example.pngCombined with the DOM selector, this field allows you to gather the value of an attribute from the selected DOM element.
GTM Data LayerGTM VariablepageTypeproductCategoryWhen your page uses the Google Tag Manager (GTM), you can configure Profile Tag to access the JavaScript variables defined in the GTM data layer. The GTM id must be a property of the object passed to the Y_TRACKING method. This is the method that you also pass the tenant and client Id to. This property must be named gtmId

Configure Selector

Deleting Selectors

To delete a selector:

  1. Click the garbage-can symbol to the right of the selector.
  2. Click the SAVE button in the top right corner to make the deleted operation take effect.
Deleting a selector is an irreversible operation, which means that you would need to re-enter the data if necessary.

Selector keys

Keys act as names, and accordingly, as identifiers for the properties to send in the message body. Profile Tag maps certain combinations of keys automatically to a schema. This allows Profile Tag to imply context from certain, reserved keys. In order for this to happen, all of the keys must be present. Otherwise, Profile Tag sends the schema context/commerce/FrontendEntered by default.

The following table shows a list of specific events and reserved keys.

SchemaReserved keys to implicitly send
context/commerce/FrontendEnterednone
context/commerce/ProductViewproductSku (stock-keeping unit, the shop-wide unique identifier of the product)
productName
productCategory
productPrice
context/commerce/CategoryViewproductCategory
context/commerce/KeywordSearchsearchTerm
productCategory (optional and, if provided, the predefined logic uses it)

Post-processing functions and parameters (optional)

There are several possibilities to process values that your interaction methods capture before Profile Tag feeds them into SAP Hybris Profile.

Assume there is already a certain interaction defined, as well as a mapping from a key key to the selector #selector. The list of mappings contains this mapping. A click on the key highlighted in blue unfolds the postprocessing options. The following picture shows that situation.

Interaction mapping - Post-processing

To add post-processing steps:

  1. Choose a function from the Function dropdown list.
  2. Set Parameter to a certain value, if the function takes this value as a parameter. Otherwise leave it empty.
  3. Click ADD.
  4. Repeat steps 1-3 for more post-processing steps.
For more information about post-processing options and their functions and parameters, see the Post-processing function and parameters section.

Post-processing functions and parameters

Sometimes taking the value of a selector and using it 1:1 in the generated payload is a suboptimal solution. Furthermore, SAP Hybris Profile can only process simple simple values, i.e. strings. Therefore, you can specify a list of post-processing steps. The steps run one after another, like a stack of papers with each paper containing an instruction. The order of these post-processing steps matters.

To insert a post-processing step between two already existing steps, or to add a step before an existing step, delete all post-processing steps and start over from scratch.

Use the post-processing functions in the user interface of Profile Tag to alter the string, array, and object values.

Simple string value post-processing

Post-processing of simple string values bases on standard JavaScript string methods:

MethodDescriptionInitial valueResult after post-processing
TrimRemoves leading and trailing whitespaces. The value remains a simple value."   abc  ""abc"
SplitRequires a non-empty, non-whitespace string as a split pattern in the field Parameters. The function converts the given string into an array. Use the array method after using the split method to manipulate the result further. For example, use a combination with Pop or Shift."a,b,c,d,e" split by ","["a", "b", "c", "d", "e"]

Post-processing of arrays

Post-processing of arrays bases on the standard JavaScript array methods.

As explained in the JavaScript as the type of data source section, you must post-process a JavaScript array or object to extract the relevant simple value, whether it is a string or a number. Because an array can be nested, that is, contain arrays as elements, you might need to apply post-processing several times to allow Profile Tag to use the data.

MethodDescriptionInitial valueResult after post-processing
ShiftReturns the first element of an array and does not take parameters.["a", "b", "c", "d", "e"]"a"
PopReturns the last element of an array and does not take parameters.["a", "b", "c", "d", "e"]"e"

Object post-processing

Use the map_get function for object post-processing. This function requires the selector to be an object at this point of the post-processing chain.

JavaScript objects are technically maps, where the stored data is called attributes. Each attribute has a value and a name, known as the key. Using the key, you can reference and obtain the desired value. Put the key inside the Parameter field.

JavaScript objects can contain multiple layers, which means that you can nest them, just like an HTML tag can contain more HTML tags inside of it. They can also contain arrays. Because of this, you might need to use map_get multiple times, or array methods, to obtain simple values.

MethodDescriptionInitial valueParameterResult after post-processing
map_getReturns the value mapped to the specified key. Takes the key of the desired value as a parameter.{"key1": "value1", "key2": "value2"}"key2""value2"
For more information about JavaScript objects, see the Mozilla Developer Network documentation.

Post-processing combination examples

Combining post-processing steps together can be quite powerful to fulfil certain use cases. The following examples demonstrate some selector possibilities.

String and array post-processing example

If you want to take the productSku from the title of the page using the selector type text, but your page titles are constructed as follows: ProductSKU + ' - ' + ProductName + ' - ' + YourShopName, take the page title and do some post-processing to cut away the unnecessary parts. Select the first element as shown in the example.

Example:

  1. Add a split function with the Parameter -. This creates an array containing three simple values: ProductSKU, ProductName, and YourShopName.
  2. Add the pop function. This will obtain the last value, ProductSKU, a simple value usable by SAP Hybris Profile.

post-processing-example-1

Object post-processing example

If you want to obtain the year a customer was born in, and the JavaScript object for the customer you obtained has the following structure, use the following procedures to get the birth year.

{  
   "customer" : {  
      "contactInformation" : {  
         "firstName" : "Groucho",
         "lastName" : "Marx",
         "birthday" : "1890/10/2"
      },
      "productsBought" : {  
         "product" : [  
            {  
               "name" : "glasses",
               "category" : "eyeglasses and sunglasses",
               "sku" : "12345"
            },
            {  
               "name" : "cigar",
               "category" : "foodstuffs, drinks and tobacco",
               "sku" : "23456"
            },
            {  
               "name" : "mustache",
               "category" : "other",
               "sku" : "34567"
            },
            {  
               "name" : "eyebrowes",
               "category" : "other",
               "sku" : "45678"
            }
         ]
      }
   }
}

To obtain the customer's birth year, access the contactInformation value by its key, using the map_get function. Use that function again with birthday as a parameter, then use split the resulting string by /, and finally use pop to get just the year.

  1. Add a map_get function with the Parameter field set to contactInformation.
  2. Add a map_get" function with the Parameter field set to birthday.
  3. Add a split function with the Parameter field set to /. This splits the simple value into an array with three elements.
  4. Add a shift function. This gets the first element.

post-processing-example-2

The result is the simple value 1890 sent with the generic PageView event.


Insert Profile Tag into the website

Include the JavaScript Tag in the code for each web page, or web page template. Edit the JavaScript Tag before inserting it into your web page code:

<script>
    (function () {
        window.Y_TRACKING = window.Y_TRACKING || function () {
            (window.Y_TRACKING.q = window.Y_TRACKING.q || []).push(arguments);
        };
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = '{profile Tag URL}';
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
    })();
    window.Y_TRACKING({tenant: '{tenant ID}', clientId: '{Client ID}', configUrl: '{Config Url}'});
</script>
  • Replace the {tenant ID} with the Identifier value of your Builder project. In the Builder, select {Your Project}, and click Administration in the left navigation column. Next, click Details in the left navigation column, and copy the value of the Identifier.
  • Replace the {Client ID} with the Identifier value of the appropriate client. In the Builder, select {Your Project}, and click Clients in the left navigation column. Then, select the appropriate client, and copy the value of the Identifier.
  • Replace {Config Url} with the value of the Configuration URL, for example https://s3.amazonaws.com/profile-tag/58d934c9974013000ec3e2fb.
  • Replace the {profile Tag URL} with a link from Profile Tag links. This explains which URL to use according to your specific scenario.
  • Optionally, if using Google Tag Manager (GTM), add a property to this object named "gtmId" along with the GTM Id as a value. For example: "... clientId: '1234', gtmId: '2123', configUrl: ..."
If your website is not using the Https protocol, add the allowInsecureCookies:true parameter to the initialization call, as shown in the following example.
<script>
    (function () {
        window.Y_TRACKING = window.Y_TRACKING || function () {
            (window.Y_TRACKING.q = window.Y_TRACKING.q || []).push(arguments);
        };
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = '{profile Tag URL}';
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
    })();
    window.Y_TRACKING({tenant: '{tenant ID}', clientId: '{Client ID}', configUrl: '{Config Url}', allowInsecureCookies:true});
</script>

Example

This is an example for an HTTP website, which uses the EU version of Profile Tag. Note that the values of the tenant, clientId, and configUrl parameters are examples only, and you need to replace them with your own values.

<script>
    (function () {
        window.Y_TRACKING = window.Y_TRACKING || function () {
            (window.Y_TRACKING.q = window.Y_TRACKING.q || []).push(arguments);
        };
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = 'https://s3.amazonaws.com/profile-tag/js/eu/profile-tag.min.js';
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
    })();
    window.Y_TRACKING({tenant: 'mycomicsshop', clientId: 'jk3eUX9wNXtGqXITd0STfoRseYEomYWX', configUrl: 'https://s3.amazonaws.com/profile-tag/c8cfar0w605c5400dd2wx1ax', allowInsecureCookies:true});
</script>


Decide which Profile Tag link to use

For Profile Tag, major versions, minor versions, and patches are released in all available zones. Three digits, such as x.y.z, represent these versions of Profile Tag. x stands for the major version, y for the minor version, and z for the patch version. Profile Tag has eight URLs available. The following list explains when to use each of those links:

  • latest: The link points to the latest version of Profile Tag on the respective server. If you use this link, your application points to the latest version of Profile Tag. With this URL, you automatically make use of all patch, minor, or major releases for Profile Tag.
  • major: The link points to the latest major version of Profile Tag on the respective server. It gets updated with minor or patch releases, but not with major releases. A new major version is released whenever a major functionality or a breaking change is introduced. A major version receives all minor and patch changes, but a major functionality or a breaking change are released as a new major version.
  • minor: The link points the latest major and minor version of Profile Tag on the respective server. Minor versions introduce minor changes for a released major version, usually introducing functionalities and non-breaking changes.
  • patch: The link points the latest major, minor, and patch version of Profile Tag on the respective server. Patches generally repair the unwanted behavior of a program.
VersionUS linkEU link
latesthttps://s3.amazonaws.com/profile-tag/js/us/profile-tag.min.jshttps://s3.amazonaws.com/profile-tag/js/eu/profile-tag.min.js
major (v.2)https://s3.amazonaws.com/profile-tag/js/us/2/profile-tag.min.jshttps://s3.amazonaws.com/profile-tag/js/eu/2/profile-tag.min.js
minor (v.2.0)https://s3.amazonaws.com/profile-tag/js/us/2.0/profile-tag.min.jshttps://s3.amazonaws.com/profile-tag/js/eu/2.0/profile-tag.min.js
patch (v.2.0.0)https://s3.amazonaws.com/profile-tag/js/us/2.0.0/profile-tag.min.jshttps://s3.amazonaws.com/profile-tag/js/eu/2.0.0/profile-tag.min.js

Table: The Profile Tag links

Which URLs to use

It is recommended that you use the URLs for the latest version of Profile Tag. To test your application before using a changed version of Profile Tag, use a specific major, minor, or patch version explicitly, and switch to a new version of Profile Tag if your tests succeed.

Release Notes published in the Dev Portal explain new version changes with every release of Profile Tag.


Consent management setting

SAP Hybris Profile tracks only the type of information for which the consumer or the tenant grants consent. If a website tracks the customer's activities, legal regulations in most countries make it necessary to inform the customer about this tracking, and guides the customer to a page containing further details.

If you want SAP Hybris Profile to track the customer's activities using the default consent settings, set the consent management setting to implicit. The system then assumes that the customer's consent exists.

If you want SAP Hybris Profile to track the customer's activities after the customer explicitly expresses consent, set the consent management setting to explicit. Then specify through which action a customer consented to be tracked. Profile Tag only tracks when the customer performs that specific action.

Profile Tag allows different consent management settings for each page. In each case, Profile Tag sends a request to Profile to receive a new consent reference. In every subsequent request, Profile Tag includes that consent reference, which represents the customer's consent settings.


Best practices

  • Try to minimize your efforts, group your configurations. If you have several different pages which are all supposed to send the same set of events, create a single page in Profile Tag.
    Example: You need two data collections for:
    • a ProductView event raised on page load with schema context/commerce/ProductView
    • an AddedToCart event raised on user interaction with schema context/commerce/AddedToCard
    You can add them to one page named Product Detail Page instead of splitting them into two product detail pages.
  • If the page already has meta information in JavaScript, use it.
  • Choose selectors that capture the data most accurately. Example:
    You want to capture product categories. Your web shop displays categories in a navigation bar, in a heading and in the URL. The categories are capitalized in the navigation bar (SOME CATEGORY), lower cased and HTML escaped in the URL (some%20category), and properly spelled in the heading (Some Category). Create a selector that captures the category from the heading.
  • Make your selectors more resilient to changes of the tagged web presence. If possible, use those elements of the page as attribute values of your selectors that are least likely to change at a redesign.
    Example: use unique DOM selectors like #product-price or #productSku.
  • Keep the selectors as simple as possible, i.e. only as complicated as needed to fill your data collections with the desired data. Thus you avoid ambiguity.


Real-time Reporting

The SAP Hybris Profile system provides a Real-time Reporting service that enables analysis of time-aggregated data from multiple sources, across multiple dimensions. The service allows you to:

  • process and analyze event streams such as clickstreams or commerce data in real time
  • create, update, and delete data tables
  • retrieve metadata about existing data tables
  • query about data using any combination of columns (dimensions), different aggregation levels and different granularity levels

For details, see the Real-time Reporting documentation.

Data ingestion

Data is usually ingested into the Real-time Reporting system from commerce storefronts or any website through Profile Tag. The Real-time Reporting system ingests data fields in submitted clickstream events into a table that you define. The table definition defines which fields in the event are ingested, and which table columns accept data from each event field.

This is an excerpt from a sample clickstream table definition. For the full clickstream specification, see the Table Creation and Replacement section of the service documentation.

{
  "description":"Profile clickstream events",
  "ingestionType":"clickstream",
  "columns": [
    {
      "name": "date",
      "type": "timestamp",
    },
    {
      "name": "productCategory",
      "type": "string",
    },
    {
      "name": "sku",
      "type": "string",
      "path": "$.productSku"
    },
    {
      "name": "views",
      "type": "string",
      "path": "$.stats.views"
    }
    ...
  ]
}

In this sample table definition:

  • The name attribute specifies the label of the column in the table that holds the event field's data.

  • The path attribute specifies the target field's location in the submitted event, using XPath notation. For example, the sku column holds data extracted from the event's productSku field; the views column holds data extracted from the event's stats:{views} element.

If you have not defined a path attribute, then the name attribute defines the field location. For example, the productCategory column holds data extracted from the event's productCategory field.
  • A single timestamp-type column is required.

The following excerpt from a sample clickstream event includes fields that are ingested into the clickstream table:

{
    "action_name": "ProductDetailPageViewEvent",
    "productName": "Canon Powershot SX 530",
    "date": "1501799650635",
    "productSku": "product234",
    "productCategory": "cameras",
    "stats": {
        "views": 3
    },
    ...
}

This event yields the following data entry in the clickstream table. Note that the action_name and productName fields are not included in the table definition, and thus are not ingested.

TABLE: clickstream

dateproductCategoryskuviews
2017-08-03T16:34:10.000Zcamerasproduct2343

Data retrieval

The Real-time Reporting service's rich query language enables retrieval and aggregation of ingested data in a wide variety of ways, across multiple dimensions, including:

  • Targeting specified fields, time intervals, and value-matching criteria
  • Grouping results by hour, day, week, or month
  • Limiting the number of returned results
  • Ordering results by specified fields, and applying hierarchical sub-ordering within result sections
  • Aggregating results by requesting one or more of the following: count, distinct count, maximum, mean, minimum, sum, standard deviation, and variance

For detailed information about querying aggregated data, see the Table Queries section of the Real-time Reporting service documentation.

Here is a sample query. Note that the query URL, rather than the query itself, specifies the target table.

{
    "interval": "2017-04-01/2017-04-03T12:00:00Z",
    "granularity": "hour",
    "dimensions": ["sku", "productCategory"],
    "order": [
        {"column": "productCategory", "direction": "ascending"},
        {"column": "sku", "direction": "ascending"}
    ],
    "limit": 10,
    "filter": { "type": "notequal", "column": "productCategory", "value": null },
    "aggregations": [
        {"type": "count", "name": "recordCount"},
        {"type": "mean", "name": "avg_views", "column": "views"}
    ]
}

The query specifies the following:

  • interval: Retrieves data within the interval from April 1, 2017 (inclusive) to noon on April 3, 2017 (exclusive)

  • granularity: Groups results by hour

  • dimensions: Retrieves data from the specified table's sku and productCategory columns

  • order: Orders results by productCategory, and by sku within each productCategory group

  • limit: Retrieves no more than ten one-hour result groups

  • filter: Retrieves data only if the data row's productCategory column has a non-null value

  • aggregations: Each record includes the recordCount of entries in each result group, and the mean of views labeled as avg_views

The query results in the following form. Note that the query groups results by hour and orders them by productCategory and sku.

[[
    {
        "date": "2017-04-01T17:00:00.000Z",
        "productCategory": "cameras",
        "sku": "product234",
        "recordCount": 2,
        "avg_views": 6
    },
    {
        "date": "2017-04-01T17:00:00.000Z",
        "productCategory": "cameras",
        "sku": "product567",
        "recordCount": 5,
        "avg_views": 11
    },
    {
        "date": "2017-04-01T17:00:00.000Z",
        "productCategory": "tools",
        "sku": "product890",
        "recordCount": 2,
        "avg_views": 3
    },
    {
        "date": "2017-04-01T18:00:00.000Z",
        "productCategory": "cameras",
        "sku": "product234",
        "recordCount": 2,
        "avg_views": 6
    },
    {
        "date": "2017-04-01T18:00:00.000Z",
        "productCategory": "tools",
        "sku": "product890",
        "recordCount": 6,
        "avg_views": 9
    },
    {
        "date": "2017-04-01T18:00:00.000Z",
        "productCategory": "tools",
        "sku": "product999",
        "recordCount": 2,
        "avg_views": 2
    },
    ...
]]


Query Data With Real-Time Reporting

Query profile data

This section describes methods for reading data from the SAP Hybris Profile system.

  • The Profile service provides GET methods to retrieve data from the profile document. By calling this service, you can retrieve the whole profile document associated with a given customer, or retrieve just a specified property value from a profile document.

  • The Profile Explorer is a debugging tool that enables you to view and navigate profile data stored in the profile document. The interface is useful for verifying that profile data is stored within the expected document.

For more details about the Profile Explorer and how to use it, see the Profile Explorer documentation.

Query aggregated data from real-time reporting

The SAP Hybris Profile system provides a Real-time Reporting service that enables analysis of data aggregated from multiple sources over time. This documentation provides a comprehensive description of the Real-time Reporting service's functions.

The Real-time Reporting Service provides a rich query language to aggregate ingested data in a wide variety of ways, including:

  • Targeting specified dimensions, time intervals, and value-matching criteria

    For example, targeting product_name within the last week where interest is sports

  • Grouping results by hour, day, week, or month

    For example, grouping product_name results by hour

  • Limiting the number of returned results

    For example, returning the first ten product_name result groups

  • Ordering results by specified dimensions and applying hierarchical sub-ordering within result sections

    For example, ordering results by browser, and ordering by product_name within each browser group

  • Aggregating results by requesting one or more of the following: count, distinct count, maximum, mean, minimum, sum, standard deviation, or variance

    For example, returning counts of product_name values or returning standard deviation of page_views

For detailed information about querying aggregated data, see the Table Queries section of the Real-time Reporting service documentation.


SAP Hybris Profile Quick Start Guide

This section presents the functionalities that the SAP Hybris Profile system offers out-of-the-box. The document provides a sample scenario that is easy to set up for the customer and results in a rich user profile.


Step 1: Subscribe to packages

To start using SAP Hybris Profile, make sure that you subscribe to the right package, and that all relevant services and modules are available in your project. To learn what packages to subscribe to, see the Prerequisites for Profile Tag section.


Step 2: Tag a website

Tracking consumers on web pages requires capturing data while consumers browse the site. This is usually accomplished with tags based on JavaScript. SAP Hybris Profile Tag offers a flexible way to adapt to the structure of your online presence. It allows you to define Data Collections that represent the data you want to capture at a given event. If such an event occurs, Profile Tag triggers a process that stores the captured information in SAP Hybris Profile. For a detailed description, see the Profile Tag documentation.

This quick start step explains how to get and tag a simple test page.

Get or create a page to tag

Follow these steps for a simple e-commerce website representing a product detail page. The website contains all of the elements that are necessary to make Profile Tag send a rich PageView, ProductDetailPageView and an AddToCart data collection. The web page is published using an ExpressJS server, but you can publish it on any other web server, such as Apache or nginx. If you only need the example page document, go to the bottom of this section. If you already have a published web page that you want to tag, you can skip this section.

  1. Download node, including the node package manager (npm), from the node.js download page and install it on your local machine.
  2. Download this ZIP file.
  3. Unzip this file at the location of your choice. The content is extracted to a directory profiletag_example_page at that location.
  4. Change to that directory and initialize your ExpressJS server instance as shown:
~$ unzip profiletag_example_page.zip
~$ cd profiletag_example_page
~/profiletag_example_page$ ./init.sh

The initialization procedure asks you some questions. Press ENTER at each step, until finished, to apply the default settings. Because this is a simple example server, these default settings suffice. The procedure also installs the ExpressJS server dependencies.

Start the ExpressJS server as shown:

~/profiletag_example_page$ ./start.sh

To check your example page, open http://localhost:3000/profiletag_example.html in your browser.

Unfold the following code section by clicking + to see the content of the example page.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example Page to document yProfile Tag config</title>
</head>
<body>
<div style="margin-left: 1cm;">
    <h1>Product Number 123456 Hybris - Coffee Mugs</h1>
    <div id="description">
        <a href="url" product_category="Mugs">Category: Mugs</a>
        <div>
            <img src="coffee-mugs.png" alt="Hybris Coffee Mugs with a couple of loose coffee beans" height="200 rem"
                 width="200 rem">
        </div>
        <div class="features">
            <ul>
                <li>
                    Ergonomic Hybris mugs, suitable for coffee
                </li>
                <li>
                    Plus a couple of loose coffee beans
                </li>
            </ul>
        </div>
    </div>
    <div id="price">
        <p>
            275,- €
        </p>
    </div>
    <button id="add_to_cart_btn" class="button" value="buttonValue" cart_id="54321">
        Add to cart
    </button>
</div>
</body>
</html>

Add Profile Tag to the website

Unfold the following code section to see how you can add Profile Tag to your example page. See the Insert Profile Tag into the website section for more details.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Example Page to document yProfile Tag config</title>
    <script>
    (function () {
        window.Y_TRACKING = window.Y_TRACKING || function () {
            (window.Y_TRACKING.q = window.Y_TRACKING.q || []).push(arguments);
        };
        var s = document.createElement('script');
        s.type = 'text/javascript';
        s.async = true;
        s.src = {profile Tag URL};
        var x = document.getElementsByTagName('script')[0];
        x.parentNode.insertBefore(s, x);
    })();
    window.Y_TRACKING({tenant: '{tenant ID}', clientId: '{Client ID}', configUrl: '{Config Url}', allowInsecureCookies:true});
    </script>
</head>
<body>
<div style="margin-left: 1cm;">
    <h1>Product Number 123456 Hybris - Coffee Mugs</h1>
    <div id="description">
        <a href="url" product_category="Mugs">Category: Mugs</a>
        <div>
            <img src="coffee-mugs.png" alt="Hybris Coffee Mugs with a couple of loose coffee beans" height="200 rem"
                 width="200 rem">
        </div>
        <div class="features">
            <ul>
                <li>
                    Ergonomic Hybris mugs, suitable for coffee
                </li>
                <li>
                    Plus a couple of loose coffee beans
                </li>
            </ul>
        </div>
    </div>
    <div id="price">
        <p>
            275,- €
        </p>
    </div>
    <button id="add_to_cart_btn" class="button" value="buttonValue" cart_id="54321">
        Add to cart
    </button>
</div>
</body>
</html>

Configure Profile Tag to send an "Add To Cart" data collection

  1. Open your project in the Builder, and select Profile Tag from the menu on the left.
  2. Click + ADD SITE and follow the instructions in the Set up Profile Tag section.
  3. After setting up a site, click + ADD NEW PAGE and set up at least one new page.
  4. Now, configure a data collection by using the Add To Cart template. Click on + NEW (USING TEMPLATE) and choose + ADD TO CART from the dropdown list.
  5. Enter the following data into the popup (note that some fields may already be filled out):
    1. Set Name to Add to Cart.
    2. Set Schema to send to context/commerce/AddedToCart.
    3. Set This Data Collection gets triggered by to On user interaction, e.g. mouse click, mouse move, etc..
    4. Set DOM-element to #add_to_cart_btn.
    5. Set Event on that DOM-element to listen to to click.
Modify the productQty selector
Desired result: 1
  1. Click productQty.
  2. Choose Constant as Type.
  3. Set Value to 1.
  4. Don't define any Post Processing.
Modify the productSku selector
<h1>Product Number 123456 Hybris - Coffee Mugs</h1>
Desired result: 123456
  1. Click productSku.
  2. Set DOM Selector to h1.
  3. Define Post Processing the following way:
    1. Set Function to split.
    2. Set Parameter to ' '.
    3. Click ADD.
    4. Set Function to map_get.
    5. Set Parameter to 2.
    6. Click ADD.
Modify the productName selector
<h1>Product Number 123456 Hybris - Coffee Mugs</h1>
Desired result: Coffee Mugs
  1. Click productName.
  2. Set DOM Selector to h1.
  3. Define Post Processing the following way:
    1. Set Function to split.
    2. Set Parameter to '-'.
    3. Click ADD.
    4. Set Function to pop.
    5. Click ADD.
Modify the productCategory selector
<div id="description">
    <a href="url" product_category="Mugs">Category: Mugs</a>
</div>
Desired result: Mugs
  1. Click productCategory.
  2. Set DOM Selector to #description a.
  3. Define Post Processing the following way:
    1. Set Function to split.
    2. Set Parameter to ' '.
    3. Click ADD.
    4. Set Function to pop.
    5. Click ADD.
Modify the productPrice selector
<div id="price">
  <p>
     275,- €
  </p>
</div>
Desired result: 275
  1. Click productPrice.
  2. Set DOM Selector to #price.
  3. Define Post Processing the following way:
    1. Set Function to split.
    2. Set Parameter to ‘,’.
    3. Click ADD.
    4. Set Function to Shift.
    5. Click ADD.
Modify the cartId selector
<button id="add_to_cart_btn" class="button" value="buttonValue" cart_id="54321">
Desired result: 54321
  1. Click cartId.
  2. Set Type to DOM Element.
  3. Set DOM Selector to #add_to_cart_btn.
  4. Set Attribute to cart_id.
  5. Don't define any Post Processing.
Finally, save and roll-out your configuration in order for your changes to take effect:
  1. Click OK in the bottom-right corner of the window.
  2. Click SAVE in the top-right corner of the window.
  3. Click BACK in the top-left corner of the window.
  4. Click ROLL-OUT in the top-right corner of the window.
See the next section to find out how to inspect the results of the captured events.


Step 3: Retrieve and browse user profiles

The events that you send to SAP Hybris Profile from your storefront trigger the enrichers. Depending on the event type, the triggered enrichers introduce various changes to the profile document.

For example, by clicking on a product in the storefront, you send the ProductDetailPageViewEvent, associated with the context/commerce/ProductView schema, to SAP Hybris Profile. This event triggers the specified enricher, which modifies the profile document by creating or updating the following subdocuments:

{
  "insights":{
    "affinities":{
      "products":{
        "product234":{
          "score":"0.3010299956639812",
          "recentViewCount":"0",
          "recentScore":"0.0"
        }
      }
    }
  },
  "observations":{
    "web":{
      "productViews":{
        "product234":{
          "link":"http:/url.to.a.sample.product",
          "recentViewCount":"1"
        }
      }
    }
  }
}

Using the dedicated Profile Explorer interface, you can browse the selected user profiles.

Explore the profile document through Profile Explorer

Access the Profile Explorer to browse the user's profile document. In the corresponding subdocument, you can find previously-saved data about page views and asset views. Thanks to the incorporated logic, the system can calculate, for example, the user's affinities for particular content. When the user views these materials again, the subdocument that contains the assets affinities score changes accordingly.

Retrieve all or part of the profile document

To retrieve a full profile document, access the Profile Explorer and provide the ID of the targeted profile in the Profile ID field. After clicking the Search button, the service returns the requested profile document in JSON format. To access part of the profile document, you can either search for it in the whole profile displayed in the result pane of the Profile Explorer, or run the following cURL command:

curl -X GET -H "Authorization: Bearer access_token" 'https://api.yaas.io/hybris/profile/v1/{tenant}/profiles/{profileId}?fields={property1},{property2}'


Step 4: Feed clicks into Real-time Reporting

Data enters the Real-time Reporting service through clickstream events that Profile Tag submits. The service ingests data fields in submitted events into a Real-time Reporting table that you define. The table definition determines which fields in the event are ingested, and which table columns accept data from each event field.

This sample table defines table columns and associates each with a clickstream event field.

{
  "description":"Profile clickstream events",
  "ingestionType":"clickstream",
  "columns": [
    {
      "name": "date",
      "type": "timestamp",
    },
    {
      "name": "productCategory",
      "type": "string",
    },
    {
      "name": "sku",
      "type": "string",
      "path": "$.productSku"
    },
    {
      "name": "views",
      "type": "string",
      "path": "$.stats.views"
    }
    ...
  ]
}

In this sample table definition:

  • The name attribute specifies the label of the column in the table that holds the event field's data.

  • The path attribute specifies the target field's location in the submitted event, using XPath notation. For example, the sku column holds data extracted from the event's productSku field; the views column holds data extracted from the event's stats:{views} element.

If you have not defined a path attribute, then the name attribute defines the field location. For example, the productCategory column holds data extracted from the event's productCategory field.
  • A single timestamp-type column is required.

The following sample clickstream event includes fields that are ingested into the clickstream table:

{
    "action_name": "ProductDetailPageViewEvent",
    "productName": "Canon Powershot SX 530",
    "date": "1501799650635",
    "productSku": "product234",
    "productCategory": "cameras",
    "stats": {
        "views": 3
    },
    ...
}

This event yields the following data entry in the clickstream table. Note that the action_name and productName fields are not included in the table definition, and thus are not ingested.

TABLE: clickstream

dateproductCategoryskuviews
2017-08-03T16:34:10.000Zcamerasproduct2343


Step 5: Query aggregated data in Real-time Reporting

The Real-time Reporting service's rich query language enables retrieval and aggregation of ingested data in a wide variety of ways, across multiple dimensions, including:

  • Targeting specified fields, time intervals, and value-matching criteria
  • Grouping results by hour, day, week, or month
  • Limiting the number of returned results
  • Ordering results by specified fields, and applying hierarchical sub-ordering within result sections
  • Aggregating results by requesting one or more of the following: count, distinct count, maximum, mean, minimum, sum, standard deviation, and variance

For detailed information about querying aggregated data, see the Table Queries section of the Real-time Reporting service documentation.

Here is a sample query. Note that:

  • "column" refers to table dimensions
  • the target table is specified in the query URL, rather than in the query itself
{
    "interval": "2017-04-01/2017-04-03T12:00:00Z",
    "granularity": "hour",
    "dimensions": ["sku", "productCategory"],
    "order": [
        {"column": "productCategory", "direction": "ascending"},
        {"column": "sku", "direction": "ascending"}
    ],
    "limit": 10,
    "filter": { "type": "notequal", "column": "productCategory", "value": null },
    "aggregations": [
        {"type": "count", "name": "recordCount"},
        {"type": "mean", "name": "avg_views", "column": "views"}
    ]
}

The query specifies the following:

  • interval: Retrieves data within the interval from April 1, 2017 (inclusive) to noon on April 3, 2017 (exclusive)

  • granularity: Groups results by hour

  • dimensions: Retrieves data from the specified table's sku and productCategory columns

  • order: Orders results by productCategory, and by sku within each productCategory group

  • limit: Retrieves no more than ten one-hour result groups

  • filter: Retrieves data only if the data row's productCategory column has a non-null value

  • aggregations: Each record includes the recordCount of entries in each result group, and the mean of views labeled as avg_views

The query results in the following form. Note that the query groups results by hour and orders them by productCategory and sku.

[[
    {
        "date": "2017-04-01T17:00:00.000Z",
        "productCategory": "cameras",
        "sku": "product234",
        "recordCount": 2,
        "avg_views": 6
    },
    {
        "date": "2017-04-01T17:00:00.000Z",
        "productCategory": "cameras",
        "sku": "product567",
        "recordCount": 5,
        "avg_views": 11
    },
    {
        "date": "2017-04-01T17:00:00.000Z",
        "productCategory": "tools",
        "sku": "product890",
        "recordCount": 2,
        "avg_views": 3
    },
    {
        "date": "2017-04-01T18:00:00.000Z",
        "productCategory": "cameras",
        "sku": "product234",
        "recordCount": 2,
        "avg_views": 6
    },
    {
        "date": "2017-04-01T18:00:00.000Z",
        "productCategory": "tools",
        "sku": "product890",
        "recordCount": 6,
        "avg_views": 9
    },
    {
        "date": "2017-04-01T18:00:00.000Z",
        "productCategory": "tools",
        "sku": "product999",
        "recordCount": 2,
        "avg_views": 2
    },
    ...
]]


Step 6: Trace data and understand the data flow

You can track the events sent from the storefront to SAP Hybris Profile in the Trace Explorer. Tracking allows you to collect details about the exact time of calls between services, and the duration of specific operations. Additionally, it allows you to detect any latency problems.

To enable tracing in your storefront, use Profile Tag in the debug mode. Activate the Profile Tag debug mode by adding the profileTagDebug flag to your storefront URL and setting its value to true. Assume your storefront URL is http://example.com. With the debug flag it looks as follows: http://example.com?profileTagDebug=true.

To navigate to the Trace Explorer, click the contextTraceId link that appears at the top of the screen each time the storefront sends an event to SAP Hybris Profile. In the Trace Explorer, you can find the logs containing the details of event processing, such as the information about the changes that your events introduce to the profile document.


Step 7: Outlook: Make use of the data in commerce and marketing

This comprehensive end-to-end flow results in a rich customer profile, which you can feed to other platforms. For example, you can use the data in SAP Hybris Commerce for personalization purposes. The moment you know your user's browsing past you are in a position to adopt the offering, the commercials, and even the layout of your storefront according to your user's interests or needs. That results in a highly personalized browsing and shopping experience. Another example is in SAP Hybris Marketing. You can use the data from SAP Hybris Profile for market segmentation to identify segments that are likely to be the most profitable or that have growth potential. Or you can use the data to generate well-known marketing contacts that you can use for efficient targeting in marketing campaigns.


  • Send feedback

    If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.

  • Get Help

    Use our private help channel. Receive updates over email and contact our specialists directly.

  • hybris Experts

    If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.