Skip to main content

Opt-in tracking

When the Uniform tracker is added to a page, visit activity is captured and stored on the visitor's browsers. By default, the tracker is rendered by virtue of the tracker code being on the page. However, your site's privacy policy may require the visitor to consent to tracking before this happens.

The specific rules that determine whether a visitor has provided their consent will vary from site to site. A popular option is to use cookies, but the cookie name and format will vary from site to site.

Uniform Optimize lets you define the rules that determine whether consent has been provided, and then ensures those rules are satisfied before the tracker is added to a page.

note

This functionality is not limited to opt-in requirements. A more accurate description of the functionality is that it is "conditional rendering", where the tracker is only rendered when certain conditions are met.

note

This functionality is only available for sites built using ASP.NET MVC. Sites built using JSS can use the features available in the front-end library (e.g. React) to achieve the same functionality on the client.

Define rule#

Uniform Optimize uses rules defined with Sitecore predefined rules to describe the conditions that must be met in order for the tracker to be added to a page.

  1. In Sitecore, open Marketing Control Panel.
  2. Navigate to Personalization > Predefined Rules.
  3. Create a new item using the template Conditional Rendering Rule.
  4. After you create the item, note the item id.
note

Opt-in rules are limited to the conditions that are supported for personalization. The specific conditions that are supported depend on the personalization engine.

Set rule on tracker#

The Uniform tracker is added to a view using an HTML helper method. The following code demonstrates how to include the opt-in rule when the tracker is rendered:

@Html.Uniform().TrackerWith(settings => {    settings.PredefinedRuleItemPath = "{########-####-####-####-############}";})
note

If the tracker has already been collecting visitor behavior data, assigning a predefined rule will not affect the data that has already been collected. Additional data will not be collected until the conditions on the predefined rule are satisfied.