Skip to content

Commit

Permalink
adding webengage for feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
abemassry committed Oct 19, 2016
1 parent f2641e8 commit d6de409
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 10 deletions.
8 changes: 3 additions & 5 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,10 @@
</head>
<body>
<div id="root" class="full-height"></div>
<script id="_webengage_script_tag" type="text/javascript">
var webengage; !function(w,e,b,n,g){function o(e,t){e[t[t.length-1]]=function(){r.__queue.push([t.join("."),arguments])}}var i,s,r=w[b],z=" ",l="init options track screen onReady".split(z),a="feedback survey notification".split(z),c="options render clear abort".split(z),p="Open Close Submit Complete View Click".split(z),u="identify login logout setAttribute".split(z);if(!r||!r.__v){for(w[b]=r={__queue:[],__v:"6.0",user:{}},i=0;i<l.length;i++)o(r,[l[i]]);for(i=0;i<a.length;i++){for(r[a[i]]={},s=0;s<c.length;s++)o(r[a[i]],[a[i],c[s]]);for(s=0;s<p.length;s++)o(r[a[i]],[a[i],"on"+p[s]])}for(i=0;i<u.length;i++)o(r.user,["user",u[i]]);setTimeout(function(){var f=e.createElement("script"),d=e.getElementById("_webengage_script_tag");f.type="text/javascript",f.async=!0,f.src=("https:"==e.location.protocol?"https://ssl.widgets.webengage.com":"http://cdn.widgets.webengage.com")+"/js/webengage-min-v-6.0.js",d.parentNode.insertBefore(f,d)})}}(window,document,"webengage");
</script>
<script src="/static/bundle.js"></script>
<script>init();</script>
</body>
<script id="_webengage_script_tag" type="text/javascript">
var webengage; !function(w,e,b,n,g){function o(e,t){e[t[t.length-1]]=function(){r.__queue.push([t.join("."),arguments])}}var i,s,r=w[b],z=" ",l="init options track screen onReady".split(z),a="feedback survey notification".split(z),c="options render clear abort".split(z),p="Open Close Submit Complete View Click".split(z),u="identify login logout setAttribute".split(z);if(!r||!r.__v){for(w[b]=r={__queue:[],__v:"6.0",user:{}},i=0;i<l.length;i++)o(r,[l[i]]);for(i=0;i<a.length;i++){for(r[a[i]]={},s=0;s<c.length;s++)o(r[a[i]],[a[i],c[s]]);for(s=0;s<p.length;s++)o(r[a[i]],[a[i],"on"+p[s]])}for(i=0;i<u.length;i++)o(r.user,["user",u[i]]);setTimeout(function(){var f=e.createElement("script"),d=e.getElementById("_webengage_script_tag");f.type="text/javascript",f.async=!0,f.src=("https:"==e.location.protocol?"https://ssl.widgets.webengage.com":"http://cdn.widgets.webengage.com")+"/js/webengage-min-v-6.0.js",d.parentNode.insertBefore(f,d)})}}(window,document,"webengage");

webengage.init("~c2ab2a21");
</script>
</html>
3 changes: 2 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ module.exports = function(config) {
ENV_API_ROOT: null,
ENV_LOGIN_ROOT: null,
ENV_APP_ROOT: null,
ENV_GA_ID: null
ENV_GA_ID: null,
ENV_WEBENGAGE_ID: null
}),
new CircularDependencyPlugin({
failOnError: true,
Expand Down
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export const API_ROOT = ENV_API_ROOT || 'https://api.alpha.linode.com/v4'; // es
export const LOGIN_ROOT = ENV_LOGIN_ROOT || 'https://login.alpha.linode.com'; // eslint-disable-line no-undef
export const APP_ROOT = ENV_APP_ROOT || 'http://localhost:3000'; // eslint-disable-line no-undef
export const GA_ID = ENV_GA_ID || '000000'; // eslint-disable-line no-undef
export const WEBENGAGE_ID = ENV_WEBENGAGE_ID || ''; // eslint-disable-line no-undef

export const LinodeStates = {
pending: [
Expand Down
13 changes: 11 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { Router, Route, IndexRedirect, browserHistory } from 'react-router';
import DevTools from './components/DevTools';
import { syncHistoryWithStore } from 'react-router-redux';
import ReactGA from 'react-ga';
import { GA_ID } from './constants';
import { GA_ID, WEBENGAGE_ID } from './constants';
import { getStorage } from './storage';

import checkLogin, { initializeAuthentication } from './session';

Expand Down Expand Up @@ -67,5 +68,13 @@ const init = () => {
document.getElementById('root')
);
};

if (window.webengage) { // eslint-disable-line no-undef
webengage.init(WEBENGAGE_ID); // eslint-disable-line no-undef
webengage.feedback.options('formData', [ // eslint-disable-line no-undef
{
name: 'email',
value: getStorage('authentication/email'),
},
]);
}
window.init = init;
3 changes: 2 additions & 1 deletion webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = {
'ENV_API_ROOT': JSON.stringify(process.env.API_ROOT),
'ENV_LOGIN_ROOT': JSON.stringify(process.env.LOGIN_ROOT),
'ENV_APP_ROOT': JSON.stringify(process.env.APP_ROOT),
'ENV_GA_ID': JSON.stringify(process.env.GA_ID)
'ENV_GA_ID': JSON.stringify(process.env.GA_ID),
'ENV_WEBENGAGE_ID': JSON.stringify(process.env.WEBENGAGE_ID)
})
],
module: {
Expand Down
3 changes: 2 additions & 1 deletion webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ _.plugins = [
'ENV_APP_ROOT': JSON.stringify(process.env.APP_ROOT),
'ENV_API_ROOT': JSON.stringify(process.env.API_ROOT),
'ENV_LOGIN_ROOT': JSON.stringify(process.env.LOGIN_ROOT),
'ENV_GA_ID': JSON.stringify(process.env.GA_ID)
'ENV_GA_ID': JSON.stringify(process.env.GA_ID),
'ENV_WEBENGAGE_ID': JSON.stringify(process.env.WEBENGAGE_ID)
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
Expand Down

0 comments on commit d6de409

Please sign in to comment.