Skip to main content

Dispatch

In most cases, the dispatch process involves the Uniform tracker converting activity it has collected into a format required by an external system, and then using the external system's API to send the converted activity there.

Uniform exposes the information from Sitecore that should be tracked (e.g. profile scores). It would be silly to send that same data back to Sitecore, and to write an application to run on the Sitecore server that can handle this data.

A simpler approach is used. Uniform sends a request to a Sitecore CD instance. The Sitecore CD instance, then, tracks the request the way Sitecore normally would.

Tracking request#

A tracking request is a request sent to Sitecore for the specific purpose of tracking a request that was not handled by Sitecore. If a Sitecore Xdb destination is configured in Sitecore, the Uniform tracker will build and send tracking requests to Sitecore.

These tracking requests include extra information that is used to identify the request as a tracking request. This information is configured on the Sitecore Xdb destination. The following options are supported:

  • Request header - Uniform adds the specified header to the tracking request before the request is sent to Sitecore.
  • Query string parameter - Uniform adds the specified query string parameter to the tracking request for the request is sent to Sitecore.
note

For information on how to configure a Sitecore Xdb destination, see the dispatch configuration documentation for Sitecore Xdb.

Pipelines#

Filter tracking request#

This pipeline is responsible for determining whether Sitecore should track a request. The result of this pipeline running is a boolean value:

  • true means the request should not be tracked.
  • false means the request should be tracked.

The default configuration of this pipeline works in the following way:

  • If no active Sitecore Xdb tracking configuration item is assigned to the current site, false is returned.
  • If the setting Only track dispatch requests is not activated, false is returned.
  • If any HTTP headers are specified in the Sitecore Xdb tracking configuration item, and at least one of the settings does not match the headers in the HTTP request, true is returned.
  • If any query string parameters are specified in the Sitecore Xdb tracking configuration item, and at least one of the settings does not match the query string parameters in the HTTP request, true is returned.
  • If none of the conditions above are met, false is returned.
note

Uniform adds a custom processor to the pipeline startAnalytics, so this pipeline runs for all requests, whether the request is a tracking request or a regular request.

Pipeline#

  • Name: filterTrackingRequest
  • Base type for custom processors: Uniform.Optimize.Pipelines.FilterTrackingRequest.FilterTrackingRequestPipelineProcessor, Uniform.Optimize.Tracking.SitecoreXdb

Pipeline args#

  • Type: Uniform.Optimize.Pipelines.FilterTrackingRequest.FilterTrackingRequestPipelineArgs, Uniform.Optimize.Tracking.SitecoreXdb

This type has the following properties:

  • SiteConfigItem - Sitecore Xdb tracking configuration item.
  • Log - Delegate for logging activity related to determining whether the request should be tracked.
  • DoNotTrack - Boolean value that indicates if the request should be tracked. In general, processors should check this value before executing their own logic.

Data shape for dispatch#

If you need to implement the OnBeforeDispatchDataHandler, the following defines the shape of the data that you transform.

info

The config object uses the Axios request config format.

info

In order for the dispatch process to work properly, you must return an object with this shape.

{  "type":"xdb",  "data":{    "url":"<CURRENT URL>",    "config":{      "method":"GET",      "headers":{        "X-Referer":""      },    "withCredentials":true    }  }}