Using the JavaScript Tag to Track Cookies

If you use Webtrends Analytics 9 or Webtrends On Premises with SmartSource Data Collector, the JavaScript tag is configured to track first-party cookies by default. Use the Tag Builder at tagbuilder.webtrends.com to create your tag and specify any additional cookie settings.

Configuring First-Party Cookie Tracking.
  1. Implement the JavaScript tag you created using the Tag Builder.
  2. Edit a profile and specify the first-party cookie data source.
  3. For the same profile, specify session tracking for first-party cookies.
Implementing the JavaScript Tag

Implement the WebtrendsJavaScript tag on all the pages that you want to track. You can place the JavaScript tag anywhere between the <body> and </body> tags on a web page. Placing the tag at the top of the page directly after the <body> tag allows the tag to execute even if the page does not fully load. However, it is best to place it at the bottom of the page just before the </body> tag to ensure the JavaScript tag is only activated after the page fully loads and all the information that the tag needs is available.

In addition to placing the tag directly in your web pages, there are other methods for tagging your pages which can make it easier to tag many pages quickly. Alternatively, you can place the tag in a client-side include file or place the tag in a footer template. For more information on these options and tagging best practices, see the Analytics 9 On Demand Implementation Guide on the Webtrends Documentation page.

Specifying the First-Party Cookie Data Source

In this step, you edit a profile and specify the first-party cookie data source for that profile.

Note: If your website has multiple domains and you want to tracking visitors across them, you must create a separate data source for each domain.
  1. In the left pane, click Administration > Web Analysis > Reports & Profiles.
  2. Mouse over a profile and click Edit on the Action menu.
  3. Click Analysis > Data Sources.
  4. Click New. If you use Webtrends Analytics 9, you cannot specify a new data source. Instead, specify the first-party cookie data source for this profile. Click Save, and follow the steps in Specifying Session Tracking for First-Party Cookies, below.
  5. In the Data Sources dialog specify the name of the server and select the data source.
  6. Click Save, and your new data source for first-party cookies appears in the list of data sources for that profile.
Specifying Session Tracking for First-Party Cookies

Session Tracking definitions determine how Webtrends identifies visits and counts unique visitors.

  1. In the left pane, click Administration > Web Analysis > Reports & Profiles.
  2. Mouse over a profile and click Edit on the Action menu.
  3. Click Analysis > Session Tracking.
  4. Clear the Always Use Default Definition check box.
  5. Click Track User Sessions Using First Party Cookie.
  6. Click Save.