dcsimg

Where to use Hash sign in the URL to allow proper tracking.

Products

Webtrends Analytics 8.x
Webtrends Analytics 9.x

Cause

Incorrect placement of the hash # symbol can cause the browser to not report on the query string in the URL.

Resolution

When the webtrends.js runs on the page it will use the following elements passed by the browser to fill in a few parameters.

DCS.dcssip = location.hostname
DCS.dcsuri = location.pathname
DCS.dcsqry = location.search

*The location.hash is not used.

Anything after the # symbol is counted as part of the location.hash in the browser, even if it looks like a query string. The browser does not recognize a query string when it occurs after the # symbol. As a result, the query string must occur prior to the # symbol for the URL to be interpreted correctly.

Here are some examples for illustration:

1) http://www.somedomain.com/en-us/products/catalog.aspx#item1?WT.test=test
a. Notice the query string comes after the # symbol.
i. location.hostname would return the domain www.somedomain.com
ii. location.pathname would return the URI stem /en-us/products/catalog.aspx
iii. location.search would return no values.
b. If location.hash was available it would return #item1?WT.test=test

2) http://www.somedomain.com/en-us/products/catalog.aspx?WT.test=test#item1
a. In this version the query string comes before the # symbol.
i. location.hostname would return the domain www.somedomain.com
ii. location.pathname would return the URI stem /en-us/products/catalog.aspx
iii. location.search would return ?WT.test=test
b. If location.hash was available it would return #item1

More Information

In order to have the # symbol passed with the URL. The webtrends.js will need to be customized or add a plugin to set the DCS.dcsuri to use “location.pathname + location.hash” instead of “location.pathname”.

Make sure that the query string appears before the hash # symbol when using one of these custom methods or errors could result in the logs.