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.
Note: The V10 JavaScript tag requires SmartSource Data Collector
version 9.2.1 or higher.
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: 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.
- Save the webtrends.min.js and
webtrends.load.js files in a common JavaScript location on
your web server.
- Edit the path referenced in
webtrends.load.js so that it points to the actual location
of webtrends.min.js.
- Edit the path referenced in
webtrends.load.html so that it points to the actual
location of webtrends.load.js.
- 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
- Save the webtrends.min.js file in a common JavaScript location on your web
server.
- Edit the path referenced in webtrends.html so that it points
to the actual location of webtrends.min.js.
- Paste the contents of webtrends.html on every page in
your web site.