Skip to content

Instantly share code, notes, and snippets.

@elbpdx
Created November 1, 2011 18:41
Show Gist options
  • Save elbpdx/1331490 to your computer and use it in GitHub Desktop.
Save elbpdx/1331490 to your computer and use it in GitHub Desktop.
Sample s., v10 js, fb plugin, our app, our dcsid's
<!-- This first block is an explicit load the facebook js for our fb implementation (remove if fb sdk is already loaded) facebook js sdk documented here: http://developers.facebook.com/docs/reference/javascript/ -->
<div id="fb-root"></div>
<script>
window.fbAsyncInit = function() {
FB.init({appId:'156294357760329', status:true, cookie:true, oauth:true, xfbml:true});
};
// load the SDK asynchronously
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = window.location.protocol + "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
</script>
<!-- next block is Webtrends v10 JS SDK implementation (async) -->
<script type="text/javascript">
window.webtrendsAsyncLoad = function(dcs){
dcs.addTransform(function(dcs,opt){
// add/edit/remove tags or cancel call with opt.prevent
},'all');
};
// Async Init/Config function, called by webtrends.js after load
window.webtrendsAsyncInit = function() {
var dcs=new Webtrends.dcs().init({dcsid:"dcsoun91e7dv0hw8hg15nkiz1_9m7o",domain:"statse.webtrendslive.com",timezone:-8,
// plugins here - showing Webtrends facebook plugin
plugins:{facebook:{src:"https://s.webtrends.com/js/webtrends.fb.js"}}
}).track();
// dual tag here, requiring 2nd dcsid
var dcs2=new Webtrends.dcs().init({dcsid:"dcsoun91e7dv0hw8hg15nkiz1_9m7o",domain:"statse.webtrendslive.com",timezone:-8,
// again, plugins here - showing Webtrends facebook plugin
plugins:{facebook:{src:"https://s.webtrends.com/js/webtrends.fb.js"}}
}).track();
};
(function() {
var s = document.createElement('script'); s.async = true;s.type="text/javascript";
s.src = 'https://s.webtrends.com/js/webtrends.js';
var s2=document.getElementsByTagName("script")[0];s2.parentNode.insertBefore(s,s2);
}());
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment