Getting Started
  • 19 May 2021
  • 3 Minutes to read
  • Dark
    Light
  • PDF

Getting Started

  • Dark
    Light
  • PDF

The JavaScript Tag provides a highly customizable integration that allows you to send data to Webtrends every time a significant event occurs on your pages. You can start with a basic implementation, which captures page views with very little coding.

Depending on the space type you're tagging for, the download contains one of the following sets of files:

For a Website space:

  • webtrends.html - A snippet of HTML code that you copy into your page's HTML, near the end of the body block. This snippet should have everything you need for a basic inline setup, where the loading code is included inline on your main page. This file loads webtrends.js directly.

  • webtrends.load.html - A snippet of HTML code that you can copy into your page's HTML, near the end of the head block. This snippet should have everything you need for a basic setup using the JavaScript "loader". This file uses webtrends.load.js to load webtrends.js.

  • readme.txt - a copy of this setup guide plus version information.

  • In the scripts directory:
    webtrends.js - This is our JavaScript Tag in unminifed form. For most customers, the minified version has everything needed, but some customers prefer to have the source for debugging.
    webtrends.min.js - This is our JavaScript Tag in minified form.
    webtrends.load.js - JavaScript for setting up and loading the Webtrends Tag. Generally we recommend, for performance, that you include the setup/loading logic directly in your document's HTML, but some users prefer to abstract the analytics code completely into its own script file.

For a Mobile Website space:

  • webtrends.lite.html - A snippet of HTML code that you copy into your page's HTML, near the end of the body block. This snippet should have everything you need for a basic inline setup, where the loading code is included inline on your main page. This file loads webtrends.lite.js directly.
  • webtrends.load.lite.html - A snippet of HTML code that you can copy into your page's HTML, near the end of the head block. This snippet should have everything you need for a basic setup using the JavaScript "loader". This file uses webtrends.load.lite.js to load webtrends.lite.js.
  • webtrends.lite.js - This is lite version our JavaScript Tag in unminified form. For most customers, the minified version has everything needed, but some customers prefer to have the source for debugging.
  • webtrends.lite.min.js - This is the lite version of our JavaScript Tag in minified form.
  • webtrends.load.lite.js - JavaScript "loader" for setting up and loading the Webtrends Tag. Generally we recommend, for performance, that you include the setup/loading logic directly in your document's HTML, but some users prefer to abstract the analytics code completely into its own script file.
  • readme.txt- a copy of this setup guide plus version information.
Note

For a description of the differences between Website and Mobile Website tags, see "Website Tag vs. Mobile Website Tag", below.

Note

We use the Google Closure Compiler with Advanced Optimizations to minify the JavaScript files.


webtrends.load Setup

Note

Using this method eliminates the need to retag your site when configuration changes are made

  1. Save the webtrends.min.js and webtrends.load.js files in a common JavaScript location on your web server.

  2. Edit the path referenced in webtrends.load.js so that it points to the actual location of webtrends.min.js.

  3. Edit the path referenced in webtrends.load.html so that it points to the actual location of webtrends.load.js.

  4. Paste the contents of webtrends.load.html on every page in your web site.

    Note

    To avoid logging hits to pages that do not load completely, and to ensure best performance, paste this code inside the <head> section of your web page.

Basic Setup

  1. Save the webtrends.min.js file in a common JavaScript location on your web server.
  2. Edit the path referenced in webtrends.html so that it points to the actual location of webtrends.min.js.
  3. Paste the contents of webtrends.html on every page in your web site.

Website Tag vs. Mobile Website Tag

There are two types of JavaScript tag: Website (implemented in webtrends.js) and Mobile Website (implemented in webtrends.lite.js). The tag is delivered after Space creation in Analytics X (the type delivered depends on the type of Space created). You can also generate a Website tag with TagBuilder.

The only difference between the tags is that the Mobile Website tag has third party cookies disabled by default, and has reduced functionality, which gives it it the smaller footprint necessary for mobile environments. The Mobile Website tag does not have these features:

  • Legacy Multitrack (there is no window.dcsMultiTrack() function)
  • Debug (there is no dcsDebug() function)
  • Dual Tagging (you may only create one instance of a object)
  • Plugins
  • On-Page Event Tracking
  • Ad Impressions
  • Version Detection (JavaScript, Flash, Silverlight)
Note

If you need any of these features on a mobile site, you can deploy a Website tag in a mobile environment.


Was this article helpful?