Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webengage #555

Merged
merged 2 commits into from
Oct 19, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -8,6 +8,9 @@
</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>
3 changes: 2 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
@@ -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,
1 change: 1 addition & 0 deletions src/constants.js
Original file line number Diff line number Diff line change
@@ -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: [
13 changes: 11 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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';

@@ -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
@@ -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: {
3 changes: 2 additions & 1 deletion webpack.config.prod.js
Original file line number Diff line number Diff line change
@@ -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: {