To personalize content on the page,

  1. Enable personalization on your site or a section of your site by setting up the cq:contextHubPath and cq:contextHubSegmentsPath properties.
  2. Create some audience segments. See examples below for examples of the types of attributes that can be used to build your audience segments.
  3. Change to Targeting mode in the toolbar (next to Peview)
  4. Create a new Activity and click Start Targeting
  5. Add experiences targeted to specific audience segments and customize component content.
  6. Use preview mode to simulate different audience segments

Things to be aware of:

  • The first time a page with personalization enabled loads, an extra ~60KB of javascript must be downloaded. This will slow down the page load. The javascript is cached, so it is only loaded on the first view of a personalized page.
  • The loading of each targeted component on a page can be delayed by up to a few seconds while the audience segment data is loaded. This delay is not just on the first page load.
  • Personalization must be enabled on pages with targeted content, but also on pages that contribute to audience segments, like tagged pages or pages you want to contribute to calculate numbers of pageviews or whether a visitor is new or returning.
  • Every domain ( is counted as a different site for persistent personalization data. For example, a site at cannot tell whether a page was loaded on (Limited workarounds may be possible via custom GTM tags.)
  • A visitor will also reset or have a separate store of persistent data for each browser or device, each incognito/private browser session, or when they clear their browser's local storage.
  • Site visitors generally have no interface for adjusting their persistent personalization data, other than possibly clearing it via clearing their browser's cache/cookies/localstorage.
  • On shared computers that do not enforce a full user profile reset between users, persistent personalization data will be shared among many users.

More Information

Audience Segment Examples

Pageview History

The pageviews contexthub store tracks prior pageviews (on pages within the same domain with personalization enabled). The number of views of any tags are tracked, as well as the number of any pages each day. Use this to target content such as:

  • distinguish first time visitors from returning visitors (pageviews/isReturning; calculated based on whether or not all pageviews were today)
  • guess interests based on past pages visited via the tags on thoe pages (pageviews/tags/tag:path:name...)
  • target content to highly engaged visitors (pageviews/week, pageviews/month)

Example based on page tags

Geographic Location

The geolocation contexthub store contains information about the user's location, such as latitude, longitude, continent, country, state, etc. Use this information to:

  • hint at page translations or other language assistance (geolocation/address/countryCode)
  • market programs for users in specific parts of the world (geolocation/continent, geolocation/address/countryCode)
  • guess at whether a user is from our area or not (geolocation/address/county, geolocation/address/regionCode)
  • guess at a user's network bandwidth capacity (geolocation/bandwidth)
  • guess at a user's timezone (geolocation/timezone)

Note: The location is guessed based on the user's network connection (IP address) information. This cannot be blocked by the user, does not pop up a request for permissions from the user, and is available for all devices. However, it is sometimes completely inaccurate.

Example based on geolocation


The campaign contexthub store contains information about any campaing information in the URL that brought the user to this site or page. Information is stored from the last utm_... URL parameters. UTM campaign parameters are a replacement for passive referrer tracking, which is generally being phased out due to privacy and security concerns. Use this information to:

  • personalize pages based on social, search or other purchased advertisements
  • target content based on custom links you add in email, social or other sources

Example based on campaign URL parameters

Custom Events

The custom-events contexthub store is a place to store and use custom keys and values. Use this information to:

  • set values from custom attributes (data-contexthub-click, data-contexthub-visible) or javascript in HTML snippets or GTM tags (see below)
  • target content based on these custom events


You can also create segments based on:

  • date and time of day (surferinfo/hour, surferinfo/month, etc.)
  • browser and device characteristics (surferinfo/browser/family, surferinfo/device/category, surferinfo/os, surferinfo/window/dimension/width, etc.)
  • boolean logic
  • other segments
  • javascript calculations

Technical Information

Contexthub store data is persisted in localStorage, which can be viewed in the "Application" tab of browser dev tools. With javascript, you can see data from all contexthub stores with ContextHub.getItem('store') or get individual values with ContextHub.getItem('geolocation/latitude').

You can set values with ContextHub.setItem('store/key', 'value'). Values will be persisted across all page loads in the domain. The store named "custom-events" is the best place for custom keys/values (e.g. ContextHub.setItem('custom-events/your-app/some-key', 'some-value').

If including a script on a lot of pages, such as via Google Tag Manager, your code should check whether the ContextHub object is actually loaded, such as writing code like if (window['ContextHub']) ContextHub.setItem(...).

More Information

Scroll to here to trigger my-custom-event