(viewName, options) - at.js 2.x

This function can be called whenever a new page is loaded or when a component on a page is re-rendered. should be implemented for single page applications (SPAs) to use the Visual Experience Composer (VEC) to create A/B Test and Experience Targeting (XT) activities. If is not implemented on the site, the VEC cannot be used for SPAs. For more information, see Single Page Application implementation.

This function was introduced with at.js 2.x. This function is not available for at.js version 1.x.
Pass in any name as a string type that you want to represent your view. This view name appears in the Modifications panel of the VEC for marketers to create actions and run their A/B Test and Experience Targeting XT activities.
options > page

TRUE: Default value of page is true. When page=true, notifications are sent to the Target backend for incrementing impression count.

A notification is always sent by default when a triggerView is called, except when options > page is set to false.

FALSE: When page=false, notifications are not sent for incrementing impression count. This approach should be used when you want to only re-render a component on a page with an offer.

Note: Custom Code offers in the VEC are not re-rendered when triggerView() is called with {page: false} as the option.

Example: True

triggerView() call to send a notification to the Target backend for incrementing activity impressions and other metrics."homeView")

Example: False

triggerView() call to not have notifications sent to the Target backend for impression counting."homeView", {page: false})

Example: Promise chaining with getoffers() and applyOffers()

To execute triggerView() when the getOffers() promise is resolved, it is important to execute triggerView() on the final block, as shown in the example below. This is necessary for the VEC to detect Views in authoring mode.{
    'request': {
        'prefetch': {
            'views': [{
                'parameters': {}
}).then(function(response) {
    // Apply Offers{
        response: response
}).catch(function(error) {
    console.log("AT: getOffers failed - Error", error);
}).finally(() => {
    // Trigger View call, assuming pageView is defined elsewhere, {
        page: true
    console.log('AT: View triggered on : ' + pageView);