Prepare Content Layouts and Site Pages to Use Consumption Analytics

Consumption analytics lets you track the usage and popularity of assets in sites. This is done automatically at the site level for all standard components, provided the asset consumption feature is enabled for the site.

To track consumption analytics for custom layouts and components, you must prepare content layouts and site pages to collect data within the site or sites where a component is used. The analytic information can then be collected when the site page renders and called in APIs for display in Oracle Content Management.

Several events can be collected for assets used on site pages.

Event Type Description
load The asset is referenced on the site page.
view The asset on the site page is scrolled into the browser viewport.
play A media asset on the site page has started to play.
download A download operation is initiated on the asset.

Preparing Pages to Collect Data

There are two ways to prepare content layouts and site pages to collect data. You can augment the rendered asset markup on the page, or manually produce asset events with direct JavaScript calls.

Component Attributes

To automatically record asset consumption events, you can add special data attributes to the rendered asset markup on the page. The data-asset-operation attribute instructs the SCSRenderAPI to automatically produce analytic events. The value syntax for the data-asset-operation attribute is <page-event>:<asset-id>:<asset-event>. Multiple asset operations can be specified per attribute, separated by a semicolon (;).

There are several parameters for the data-asset-operation attribute.

Parameter Name Description
page-event A page-event normally corresponds to a DOM event, like click and play events on elements. The supported page events include:
  • view—the element has scrolled into the browser viewport

  • play—a <video> element has started to play

    This corresponds to the DOM play event on <video> elements.

  • click—the element has been clicked

    This corresponds to the DOM click event.

asset-id The id of the content item or digital asset.
asset-event One of the supported asset events
  • load

  • view

  • play

  • download

For example, the final markup of a simple content item might look like this:

<div data-asset-operation="view:COREBE60D5159507409B97E9B5CD27937B82:view">
    Hello World!

The data-asset-operation attribute in this markup automatically generates a load event for the asset when this markup appears on the page. Additionally, a view event will be recorded when the item is scrolled into view in the browser viewport.

JavaScript API Calls

JavaScript can also be used to record asset events. The SCSRenderAPI object exposes the following function to record asset events:
SCSRenderAPI.recordAssetOperation( assetId, assetEvent ) → {Boolean}
Name Type Required Description
assetId String Yes The id of the content item or digital asset.
assetEvent String Yes One of the supported asset events
  • load

  • view

  • play

  • download

This object returns a Boolean value of true if the event was accepted for recording, or false if not accepted.

For example, the following script records a play event when the button with the specified addetId is clicked.

<button onclick="javascript:SCSRenderAPI.recordAssetOperation('CONTBEAA53457DDE412B872D21DDC05FED5D', 'play')">Play the Associated Video</button>
Once you've prepared your content layout and site pages, you will need to republish your site.


Consumption analytics must be enabled in site settings before analytic information can be recorded.

Additional Examples

The following is an example of adding data-asset-operation markup for digital assets.

The following is an example of adding data-asset-operation markup for referenced field types.

<ul data-asset-operation="view:COREBE60D5159507409B97E9B5CD27937B82:view">
<li>Name: Joe Bloggs</li>
<li>Age: 39</li>
<li>Photo: <img data-asset-operation="view:CONTBE5A53457DAE412B872C21DDC05FED5D:view" src=""></li>
<li>Video: <video data-asset-operation="view:CONTBE5A53457DAE412B872C21DDC05FED5D:view;play:CONTBE5A53457DAE412B872C21DDC05FED5D:play" src=""></video></li>