Creating a tag library definition file
A tag library definition file is used to deploy custom JSP tag libraries. The WebSphere Commerce analytics tags are implemented as custom JSP tags, so you need to create a taglib definition file (TLD) for the analytics system. All the tags that you create for the analytics system need to be defined in the TLD file.
Procedure
- In the Enterprise Explorer view, navigate to Stores > WebContent > WEB-INF
- Right-click the WEB-INF folder; then click New > File.
-
In the File Name field, type a name for the file.
For example,
mytaglib.tld
. - Click Finish .
-
Enter your tag library definition.
The following is a sample snippet of the tag library definition for the page view tag class example from the previous task:
<?xml version="1.0" encoding="ISO-8859-1" ?> <taglib> <tlib-version>1.0</tlib-version> <jsp-version>1.2</jsp-version> <short-name>mytld</short-name> <uri>http://commerce.your_company_name.com/mytld</uri> <display-name>Tag library for Analytics enablement</display-name> <description>A convenience tag library for Analytics enablement on WebSphere Commerce</description> <tag> <name>pageview</name> <tag-class>com.your_company_name.bi.taglib.MyPageViewTag</tag-class> <body-content>empty</body-content> <description>Includes the required vendor specific JavaScript libraries.</description> <attribute> <name>pagename</name> <required>false</required> <rtexprvalue>true</rtexprvalue> <description>Name of the page being viewed. If missing, the page title will be used.</description> </attribute> </tag> </taglib>
For your page view tag: if you want to use the auto tagging utility to tag all your store pages with page view tags, make sure to use the tag name
pageview
, as in the previous snippet. - Save the file.