Merge pull request #467 from travis-ci/ps-pendo.io

Add pendo.io integration
This commit is contained in:
Piotr Sarnacki 2016-03-02 15:15:51 +01:00
commit 20b72e5f10
4 changed files with 28 additions and 3 deletions

View File

@ -7,9 +7,11 @@ export default TravisRoute.extend(BuildFaviconMixin, {
beforeModel() {
this._super.apply(this, arguments);
return this.get('auth').refreshUserData().then((function() {}), (() => {
return this.get('auth').refreshUserData().then( () => {
this.setupPendo();
}, () => {
return this.get('auth').signOut();
}));
});
},
renderTemplate: function() {
@ -60,6 +62,24 @@ export default TravisRoute.extend(BuildFaviconMixin, {
}
},
setupPendo() {
if(!window.pendo) {
return;
}
let user = this.get('auth.currentUser');
var options = {
visitor: {
id: user.get('id'),
github_login: user.get('login'),
email: user.get('email')
}
};
window.pendo.identify(options);
},
actions: {
redirectToGettingStarted() {
// do nothing, we handle it only in index path
@ -88,6 +108,7 @@ export default TravisRoute.extend(BuildFaviconMixin, {
afterSignIn() {
var transition;
this.setupPendo();
if (transition = this.auth.get('afterSignInTransition')) {
this.auth.set('afterSignInTransition', null);
return transition.retry();

View File

@ -34,6 +34,7 @@
"ember-cli-htmlbars-inline-precompile": "^0.3.1",
"ember-cli-inject-live-reload": "^1.3.1",
"ember-cli-inline-images": "^0.0.4",
"ember-cli-pendo": "drogus/ember-cli-pendo",
"ember-cli-pretender": "0.3.1",
"ember-cli-qunit": "^1.2.1",
"ember-cli-release": "0.2.8",

View File

@ -73,5 +73,6 @@ run Travis::Web::App.build(
code_climate_url: ENV['CODE_CLIMATE_URL'],
assets_host: ENV['ASSETS_HOST'],
ajax_polling: ENV['AJAX_POLLING'],
github_orgs_oauth_access_settings_url: ENV['GITHUB_ORGS_OAUTH_ACCESS_SETTINGS_URL']
github_orgs_oauth_access_settings_url: ENV['GITHUB_ORGS_OAUTH_ACCESS_SETTINGS_URL'],
pendo_key: ENV['PENDO_KEY']
)

View File

@ -191,6 +191,8 @@ class Travis::Web::App
pusher['path'] = options[:pusher_path] if options[:pusher_path]
config['pusher'] = pusher
config['ember-cli-pendo'] = { apiKey: options[:pendo_key] }
config['gaCode'] = options[:ga_code] if options[:ga_code]
config['pro'] = options[:pro] if options[:pro]
config['enterprise'] = options[:enterprise] if options[:enterprise]