Tracks each page that a user visits and makes it easy for that user to backtrack and return to pages he or she has already visited.
Class Name |
|
---|---|
Component | Not provided with ATG Adaptive Scenario Engine |
Required Input Parameters
Supply either the item
or itemName
parameter:
item
The item to add to the historyList
.
itemName
The name of the current page that is an anchor text in a link back to the current page.
Optional Input Parameters
navAction
Set to the desired action: push
, pop
, or jump
. If unset, the default action is push
.
navCount
Detects when a user clicks on the Back button in order to reset the navigation path.
Usage Notes
NavHistoryCollector can track each page that a user visits and makes it easy for that user to backtrack and return to pages he or she has already visited. NavHistoryCollector keeps track of a user’s path from the top of the site to the current location in a stack of information that is manipulated differently depending on how the user navigates through the site. For more information about different ways of catalog navigation, see CatalogNavigation in the CatalogNavigationandSearching chapter of the ATGCommerceAdministrationandDevelopmentGuide.
Example
The Pioneer Cycling Reference Application uses the component /atg/commerce/catalog/CatalogNavHistoryCollector
to collect the locations visited and to add them to the array of visited locations. In Pioneer Cycling, the visited locations are the repository items that represent the products and categories of the product catalog. This snippet, taken from breadcrumbs.jsp
, invokes the CatalogNavHistoryCollector
:
<dsp:droplet name="/atg/dynamo/droplet/Switch"> <dsp:param name="value" param="no_new_crumb"/> <dsp:oparam name="true"> </dsp:oparam> <dsp:oparam name="default"> <dsp:droplet name="CatalogNavHistoryCollector"> <dsp:param name="navAction" param="navAction"/> <dsp:param name="item" param="element"/> </dsp:droplet> </dsp:oparam> </dsp:droplet>
Although both techniques used in this code sample are specific to the Pioneer Cycling implementation, they can be applied to any site. First, notice that the required parameter navCount
is not passed to CatalogNavHistoryCollector. The navCount
parameter is set in the page that invokes this JSP snippet. Because JSP files invoked as servlets from other JSP files are in a sub-scope of their callers, they have access to the same parameters as the caller. Second, the no_new_crumb
parameter decides whether or not to invoke the snippet. This is just a switch on a parameter passed to the page to determine whether to add the current location to the NavHistory
or not. However, it shows how Pioneer Cycling addresses navigation for pages that do not represent catalog items. For example, the search page, the shopping cart, and the user profile page are not added to the NavHistory
like regular catalog pages. For more information on navigation in the Pioneer Cycling demo, see AddingCatalogNavigation in the DisplayingandAccessingtheProductCatalog chapter of the ATG Consumer Commerce Reference Application Guide.