Run GA instructions only if gaCode is set

This commit is contained in:
Piotr Sarnacki 2016-01-13 12:04:26 +01:00
parent c96a4602cd
commit efaae492c4
3 changed files with 10 additions and 5 deletions

View File

@ -1,10 +1,13 @@
import Ember from 'ember'; import Ember from 'ember';
import config from 'travis/config/environment';
export default Ember.Controller.extend({ export default Ember.Controller.extend({
actions: { actions: {
gaCta(location) { gaCta(location) {
_gaq.push(['_trackPageview', '/virtual/signup?' + location]); if(config.gaCode) {
return this.auth.signIn(); _gaq.push(['_trackPageview', '/virtual/signup?' + location]);
}
this.auth.signIn();
} }
} }
}); });

View File

@ -3,8 +3,10 @@ import Ember from 'ember';
export default Ember.Controller.extend({ export default Ember.Controller.extend({
actions: { actions: {
gaCta(location) { gaCta(location) {
_gaq.push(['_trackPageview', '/virtual/signup?' + location]); if(config.gaCode) {
return this.auth.signIn(); _gaq.push(['_trackPageview', '/virtual/signup?' + location]);
}
this.auth.signIn();
} }
} }
}); });

View File

@ -33,7 +33,7 @@ var Router = Ember.Router.extend({
didTransition() { didTransition() {
this._super.apply(this, arguments); this._super.apply(this, arguments);
if (config.gaCode) { if (config.gaCode) {
return _gaq.push(['_trackPageview', location.pathname]); _gaq.push(['_trackPageview', location.pathname]);
} }
} }
}); });