Skip to content

Instantly share code, notes, and snippets.

@jumpingdeeps
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jumpingdeeps/9c81c5f9cbfcb333b2eb to your computer and use it in GitHub Desktop.
Save jumpingdeeps/9c81c5f9cbfcb333b2eb to your computer and use it in GitHub Desktop.
<!--Example Intercom Settings-->
<script id="IntercomSettingsScriptTag">
window.intercomSettings = {
...
};
</script>
<script>(function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',intercomSettings);}else{var d=document;var i=function(){i.c(arguments)};i.q=[];i.c=function(args){i.q.push(args)};w.Intercom=i;function l(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://static.intercomcdn.com/intercom.v1.js';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);}if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})()</script>
<!--end Example Intercom-->
<!-- begin example Wootric code -->
<script>
var testDate = new Date();
// callback that logs survey shown
var show_survey_callback = function() {
console.log("wootric_survey_callback");
Intercom('update', {"last_wootric_surveyed_at": Math.round((testDate.getTime())/1000) });
}
//callback that logs survey declined
var decline_submitted_callback = function() {
console.log("wootric_decline_callback");
Intercom('update', {"last_wootric_declined_at": Math.round((testDate.getTime())/1000)});
}
// callback that logs survey responses
var response_submitted_callback = function(score, comment) {
console.log("wootric_response_callback");
console.log(score);
console.log(comment);
Intercom('update', {"last_wootric_score": parseInt(score),"last_wootric_comment": decodeURIComponent(comment)});
}
window.wootricSettings = {
email: 'nps@example.com',
created_at: 1234567890,
account_token: 'NPS-xxxxxxxx',
product_name: 'Schmendricks',
properties : {
role : 'reporter',
plan : 'enterprise'
},
survey_callback: show_survey_callback,
decline_callback: decline_submitted_callback,
response_callback: response_submitted_callback
};
</script>
<script type="text/javascript">
/*{literal}<![CDATA[*/
if(window.wootricSettings){i=new Image;i.src="//d8myem934l1zi.cloudfront.net/pixel.gif?account_token="+window.wootricSettings.account_token+"&email="+encodeURIComponent(window.wootricSettings.email)+"&created_at="+window.wootricSettings.created_at+"&url="+encodeURIComponent(window.location)+"&random="+Math.random()}window.lightningjs||function(c){function g(b,d){d&&(d+=(/\?/.test(d)?"&":"?")+"lv=1");c[b]||function(){var i=window,h=document,j=b,g=h.location.protocol,l="load",k=0;(function(){function b(){a.P(l);a.w=1;c[j]("_load")}c[j]=function(){function m(){m.id=e;return c[j].apply(m,arguments)}var b,e=++k;b=this&&this!=i?this.id||0:0;(a.s=a.s||[]).push([e,b,arguments]);m.then=function(b,c,h){var d=a.fh[e]=a.fh[e]||[],j=a.eh[e]=a.eh[e]||[],f=a.ph[e]=a.ph[e]||[];b&&d.push(b);c&&j.push(c);h&&f.push(h);return m}; return m};var a=c[j]._={};a.fh={};a.eh={};a.ph={};a.l=d?d.replace(/^\/\//,(g=="https:"?g:"http:")+"//"):d;a.p={0:+new Date};a.P=function(b){a.p[b]=new Date-a.p[0]};a.w&&b();i.addEventListener?i.addEventListener(l,b,!1):i.attachEvent("on"+l,b);var q=function(){function b(){return["<head></head><",c,' onload="var d=',n,";d.getElementsByTagName('head')[0].",d,"(d.",g,"('script')).",i,"='",a.l,"'\"></",c,">"].join("")}var c="body",e=h[c];if(!e)return setTimeout(q,100);a.P(1);var d="appendChild",g="createElement", i="src",k=h[g]("div"),l=k[d](h[g]("div")),f=h[g]("iframe"),n="document",p;k.style.display="none";e.insertBefore(k,e.firstChild).id=o+"-"+j;f.frameBorder="0";f.id=o+"-frame-"+j;/MSIE[ ]+6/.test(navigator.userAgent)&&(f[i]="javascript:false");f.allowTransparency="true";l[d](f);try{f.contentWindow[n].open()}catch(s){a.domain=h.domain,p="javascript:var d="+n+".open();d.domain='"+h.domain+"';",f[i]=p+"void(0);"}try{var r=f.contentWindow[n];r.write(b());r.close()}catch(t){f[i]=p+'d.write("'+b().replace(/"/g, String.fromCharCode(92)+'"')+'");d.close();'}a.P(2)};a.l&&q()})()}();c[b].lv="1";return c[b]}var o="lightningjs",k=window[o]=g(o);k.require=g;k.modules=c}({}); window.wootric = lightningjs.require("wootric", "//d27j601g4x0gd5.cloudfront.net/beacon.js"); window.wootric("run");
/*]]>{/literal}*/</script>
<!-- end example Wootric code -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment