Skip to content

Instantly share code, notes, and snippets.

@araddon
Created September 15, 2011 17:03
Show Gist options
  • Select an option

  • Save araddon/1219820 to your computer and use it in GitHub Desktop.

Select an option

Save araddon/1219820 to your computer and use it in GitHub Desktop.
Dual Track Webtrends Init
<script type="text/javascript">
// this function is called by webtrends.js after it has loaded, the track, init method are chained
window.webtrendsAsyncInit = function() {
var dcs=new Webtrends.dcs().init({dcsid:"YOUR_DCS_ID",timezone:-8}).track();
var dcs2=new Webtrends.dcs().init({dcsid:"YOUR_DCS_ID",timezone:-8}).track();
};
(function() {
var s = document.createElement('script'); s.type="text/javascript"; s.async = true;
s.src = 'http://s.webtrends.com/js/webtrends.js';
var s2=document.getElementsByTagName("script")[0];s2.parentNode.insertBefore(s,s2);
}());
</script>
@elbpdx

elbpdx commented Sep 15, 2011

Copy link
Copy Markdown

If you are adding a plugin, you need to add that into the "var dcs..." line as well, correct?

For example, to add the Facebook plugin, you'd change:

  var dcs=new Webtrends.dcs().init({dcsid:"your_dcs_id",timezone:-8}).track();
  var dcs2=new Webtrends.dcs().init({dcsid:"your_2nd_dcs_id",timezone:-8}).track();

to instead read:

  var dcs=new Webtrends.dcs().init({dcsid:"your_dcs_id",timezone:-8,plugins:{facebook:{src:"/"your_src_dir"/webtrends.fb.js"}}}).track();
  var dcs2=new Webtrends.dcs().init({dcsid:"your_2nd_dcs_id",timezone:-8,plugins:{facebook:{src:"/"your_src_dir"/webtrends.fb.js"}}}).track();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment