Skip to content
Prev Previous commit
Moved analytics ID from Config to Environment.
  • Loading branch information
bursauxa committed Jan 5, 2017
commit 5c84ec427850fed6e841a56dba1ed1f97266dc4b
14 changes: 7 additions & 7 deletions generators/app/templates/sources/main/_main.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export interface IApplicationConfig {
version: string;
environment: IApplicationEnvironment;
supportedLanguages: Array<string>;
googleAnayticsId: string;
}

export interface IApplicationEnvironment {
debug: boolean;
googleAnayticsId: string;
server: IServerConfig;
}

Expand All @@ -20,6 +20,10 @@ let environment = {
local: {
debug: true,

// Google Analytics account. Leave null to not have any analytics active.
// Typical values are of the form 'UA-########-1', where each # is a digit.
googleAnayticsId: null,

// REST backend configuration, used for all web services using restService
server: {
url: '',
Expand All @@ -28,6 +32,7 @@ let environment = {
},
production: {
debug: false,
googleAnayticsId: null,
server: {
<% if (props.target === 'web') { -%>
url: '',
Expand Down Expand Up @@ -57,12 +62,7 @@ let config: IApplicationConfig = {
supportedLanguages: [
'en-US',
'fr-FR'
],

// Google Analytics account. Leave null to not have any analytics active.
// Typical values take the form 'UA-########-1'.
// Advice : this value may be handled by the gulp build task to use different accounts for development and production.
googleAnayticsId: null
]

};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import app from 'main.module';
import {ILogger, LoggerService} from 'helpers/logger/logger';
import {IApplicationConfig} from 'main.constants';
import {IApplicationEnvironment} from 'main.constants';

const analyticsScriptUrl = '//www.google-analytics.com/analytics.js';

Expand All @@ -17,7 +17,7 @@ export class AnalyticsService {
private analyticsAreActive = false;

constructor(private $window: IWindowWithAnalytics,
private config: IApplicationConfig,
private config: IApplicationEnvironment,
logger: LoggerService) {

this.logger = logger.getLogger('analyticsService');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logger not needed if it's not used, or maybe it could be used to log tracked events?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely, logging tracked events was the point. I must have lost it somewhere along the road ; will fix it now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done earlier (with previous changes).

Expand Down