Page events, goals, outcomes, and custom analytics data
Connect generates page events, goals, and outcomes at key points when running a storefront and the API is called. For example: cart manipulation page events that record contact cart activities, visitor order creation goals and outcomes, site language selection, searches, selected sort orders, and so on. Many of the visitor activities are recorded as they navigate the website.
The recorded activities are then used to feed the Experience Profile Commerce reports as well as the Experience Analytics Commerce dimensions, which are used to report on. While Sitecore provides a lot of important information around the visitor interactions, Connect extends it with additional events, goals, and outcomes, and augments the recorded data with its own custom values adding Connect state information to the visitor interactions.
This is where the custom Analytics Data
and Outcome Data
classes are used. Each of these classes provides an abstraction and a mechanism to serialize data into Sitecore interactions and a means to rehydrate the serialized values. This is currently used for reporting purposes but can be customized and used in different kinds of scenarios for searching and filtering when segmenting contacts and personalizing content.
The classes provide an abstraction and a strongly typed interface to the analytics data collected in Connect and it is best practice to use them to access the data. It is not considered best practice to access the data directly in custom values because Sitecore might change the implementation of what and how the data is persisted and retrieved. The result of directly accessing the data in custom values is undefined.
You can find the Analytics Data
and Outcome Data
classes in the Sitecore.Commerce.AnalyticsData
and Sitecore.Commerce.OutcomeData
namespaces of the Connect framework.
Sitecore Commerce Connect does not support GraphQL requests.
The Commerce Connect services rely on tracked analytics data, such as interactions or contacts. Analytics tracking for GraphQL requests is disabled by default in Sitecore as it can have negative effect on performance.
In the age of online shopping, a wealth of information is recorded in xDB when a customer visits a storefront site. You can limit the number of transactions recorded by setting a threshold or excluding certain activities.
Limit the number of transactions recorded in xDB
By default, a maximum of 50 transactions per session are recorded in xDB. Once the maximum is reached, no more entries are added for that session and reports and marketing automation campaigns do not show or act on additional customer activities. To modify the limit, change the threshold value.
<processor type="Sitecore.Analytics.Pipelines.EnsureSessionContext.SetDummySession, Sitecore.Analytics">
<MaxPageIndexThreshold>50</MaxPageIndexThreshold>
</processor>
Exclude APIs from being tracked
To reduce the number of records in xDB, you can exclude APIs from being tracked by defining the path to those APIs you want excluded in the Sitecore.Commerce.config
file. Connect does this by reading the xDB <startTracking> pipeline and aborting the process when it detects that an API is in the exclusion list. Aborting the pipeline causes the Tracker to be <null>, which is why the API should not try to access xDB during processing.
Do not exclude APIs that raise page events, goals, or outcomes or those that require Tracker, for example, to access xDB contact information).
The . file adds the ExcludeUrlTracking
processor to the <startTracking>
pipeline.
<pipelines>
<startAnalytics>
<processor patch:before="processor[@type='Sitecore.Analytics.Pipelines.StartAnalytics.CheckPreconditions,
Sitecore.Analytics']" type="Sitecore.Commerce.Pipelines.StartsAnalytics.ExcludeUrlTracking,
Sitecore.Commerce.Connect.Core"/>
</startAnalytics>
</pipelines>
Add the APIs that you want to exclude to the <excludeTracking>
section as follows:
<excludeUrlTracking>
<url>/api/API_1</url>
<url>/api/API_2</url>
</excludeUrlTracking>