You can trigger each type of event in one or more ways.

Triggering Session Login, Logout, or Register Events

A session login, logout, or register event is triggered by default whenever a user successfully submits a form created with the Profile Form Handler methods. See the Working with Forms and Form Handlers chapter in the ATG Platform Programming Guide for more information about how the Profile Form Handler handles login, logout, and registration events.

Triggering New Session Events

The Personalization module adds a new servlet, SessionEventTrigger, to the ATG servlet pipeline. This pipeline servlet checks each request to see if it represents the start of a new session. If so, it triggers a new session event, which is sent to the Event Distributor’s session channel.

Triggering Page View Events

The PageViewServletTrigger is another pipeline servlet. This servlet triggers a page view event for each page that is served.

Triggering an event for every page viewed could adversely affect performance on a large site. Instead, you may want to trigger page view events only for particular pages. To do this you can disable the PageViewServletTrigger by setting its broadcastPageViewedEvents property to false. Then, set the page view event trigger in each Page, using an ATG Servlet Bean with the Nucleus path /atg/userprofiling/SendPageEvent, as in this example:

<droplet bean="/atg/userprofiling/SendPageEvent"></droplet>

Any time a page with this tag is rendered, the SendPageEvent component triggers a page view event and sends it to the Event Distributor’s page channel.

You can configure the SendPageEvent component with an optional parameter named pageviewed. The value of pageviewed sets a name for the page being viewed in the path property of the PageViewedEvent. If you do not set a value for the pageviewed parameter, then this value defaults to the requestURI property of the request object.

By default, the PageViewServletTrigger pipeline servlet and SendPageEvent servlet bean strip out any query arguments from the URI in the page event. If you want to retain the query arguments in the URI, set the removeURIArguments property of /atg/userprofiling/PageEventTrigger to false.

Page view events are triggered each time the ATG server downloads a page. They are not repeatedly triggered in the following instances unless a user deliberately decides to reload a page:

Triggering View Item Events

Each of the targeting servlet beans described in the Serving Targeted Content with ATG Servlet Beans chapter of the ATG Page Developer's Guide can trigger a JMS ViewItem event for each repository item returned by the targeter. For example, suppose a page with a TargetingForEach servlet bean returns an array of seven content items. When the system serves this page, seven ViewItem events are sent.

You can enable this behavior for any targeting servlet by setting the following parameters in the servlet:

<param name="fireViewItemEvent" value="true">

For more information on the JMS ViewItem event, see ViewItem Event in the part of this manual that describes scenario features.

Note: Earlier versions of ATG products used fireContentEvent and fireContentTypeEvent servlet bean parameters instead of the fireViewItemEvent parameter. These earlier parameters were triggered when the targeter returned content repository items (but not items from other repositories). They sent content view and content-type view events to the Event Distributor’s content channel and content-type channel, respectively. Although these parameters still work as intended in any existing targeters, they have been deprecated in favor of the more flexible fireViewItemEvent parameter, which is triggered when an item from any repository (including, for example, the profile repository) is viewed.

If an existing targeter uses the fireContentEvent and fireContentTypeEvent parameters, and you want to prevent the targeter from firing any events, you must set the parameters as follows in addition to turning off the fireViewEvent parameter described above:

<param name="fireContentEvent" value="false">
<param name="fireContentTypeEvent" value="false">
TargetedContentTrigger Servlet Bean

The atg.targeting.TargetedContentTrigger servlet bean is designed to be nested in the <oparam> tag of another targeting servlet. You can use it to enable or disable an event trigger in a particular targeting servlet bean instance.

The TargetedContentTrigger expects the following parameters to be available from the servlet bean that contains it:

The TargetedContentTrigger by default fires both a content event and a content type event. If you don’t want to fire one of the events, you can set one of the following parameters to false:

For example, if you want to set the TargetedContentTrigger servlet bean to trigger a content view event, and not a content type event, use the following code.

JSP example:

<dsp:droplet name="/atg/targeting/RepositoryLookup">
  <dsp:param bean="/atg/userprofiling/SendPageEvent" name="targeter"/>
  <dsp:param value="viewedContent" name="element"/>
    <dsp:oparam name="output">
       <dsp:droplet name="/atg/targeting/TargetedContentTrigger">
          <dsp:param value="false" name="fireContentTypeEvent"/>

JHTML example:

<droplet bean="/atg/targeting/RepositoryLookup">
  <param name="targeter" value="bean:/atg/userprofiling/SendPageEvent">
  <param name="element" value="viewedContent">
    <oparam name="output">
       <droplet bean=/atg/targeting/TargetedContentTrigger>
          <param name="fireContentTypeEvent" value="false">

For more information, see Nesting Servlet Beans in the Using ATG Servlet Beans chapter of the ATG Page Developer's Guide.

Note, however, that the fireContentEvent and fireContentTypeEvent parameters used by the TargetedContentTrigger have been deprecated. Refer to the previous section, Triggering View Item Events, for more information.