intercom.js 1.4 KB

1234567891011121314151617181920212223242526272829
  1. const path = require("path");
  2. module.exports = function (context) {
  3. const { siteConfig } = context;
  4. const { themeConfig } = siteConfig;
  5. return {
  6. name: "@pankod/docusaurus-plugin-intercom",
  7. injectHtmlTags() {
  8. return {
  9. postBodyTags: [
  10. {
  11. tagName: "script",
  12. innerHTML: `
  13. window.intercomSettings = {
  14. api_base: "https://api-iam.intercom.io",
  15. app_id: "m6xbwbzo"
  16. };
  17. // We pre-filled your app ID in the widget URL: 'https://widget.intercom.io/widget/m6xbwbzo'
  18. (function(){var w=window;var ic=w.Intercom;if(typeof ic==="function"){ic('reattach_activator');ic('update',w.intercomSettings);}else{var d=document;var i=function(){i.c(arguments);};i.q=[];i.c=function(args){i.q.push(args);};w.Intercom=i;var l=function(){var s=d.createElement('script');s.type='text/javascript';s.async=true;s.src='https://widget.intercom.io/widget/m6xbwbzo';var x=d.getElementsByTagName('script')[0];x.parentNode.insertBefore(s,x);};if(document.readyState==='complete'){l();}else if(w.attachEvent){w.attachEvent('onload',l);}else{w.addEventListener('load',l,false);}}})();
  19. `,
  20. },
  21. ],
  22. };
  23. },
  24. };
  25. };