feat: Configure Chatwoot & Analytics for SaaS app (#2975)

* feat: Add Chatwoot support inside Chatwoot SaaS
* Fix identity issues with Chatwoot
This commit is contained in:
Pranav Raj S
2021-09-07 23:11:01 +05:30
committed by GitHub
parent 8de4ce0037
commit 4759730022
12 changed files with 125 additions and 39 deletions

View File

@@ -48,6 +48,14 @@
}
window.errorLoggingConfig = '<%= ENV.fetch('SENTRY_DSN', '')%>'
</script>
<% if @global_config['ANALYTICS_TOKEN'].present? && @global_config['ANALYTICS_HOST'].present? %>
<script>
window.analyticsConfig = {
token: '<%= @global_config['ANALYTICS_TOKEN'] %>',
host: '<%= @global_config['ANALYTICS_HOST'] %>',
}
</script>
<% end %>
<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>
</head>
@@ -55,21 +63,14 @@
<div id="app"></div>
<noscript id="noscript">This app works best with JavaScript enabled.</noscript>
<%= yield %>
<% @global_config['CHATWOOT_INBOX_TOKEN'] %>
<% if @global_config['CHATWOOT_INBOX_TOKEN'] %>
<% if @global_config['CHATWOOT_INBOX_TOKEN'].present? %>
<script>
window.chatwootSettings = {
hideMessageBubble: true,
position: 'left',
};
window.chatwootSettings = { hideMessageBubble: true, position: 'left' };
(function(d,t) {
var BASE_URL="";
var BASE_URL="https://app.chatwoot.com";
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src=BASE_URL+"/packs/js/sdk.js";
g.defer = true;
g.async = true;
g.src=BASE_URL+"/packs/js/sdk.js"; g.defer=true; g.async=true;
s.parentNode.insertBefore(g,s);
s.async=!0;
g.onload=function(){
window.chatwootSDK.run({
websiteToken: '<%= @global_config['CHATWOOT_INBOX_TOKEN'] %>',