Skip to content

Commit

Permalink
gtag hide/show
Browse files Browse the repository at this point in the history
  • Loading branch information
amirbashan committed Jan 26, 2025
1 parent c40047f commit 94e6444
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion projects/srm/src/app/analytics.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Injectable } from '@angular/core';
import { Card, SearchParams } from './consts';
import { PlatformService } from './platform.service';
import { WindowService } from './window.service';
import { environment } from '../environments/environment';

declare const window: {
gtag: any
Expand All @@ -25,7 +26,8 @@ export class AnalyticsService {
}

gtag(...args: any[]) {
if (this.platform.browser() && window?.gtag) {
const isGtag = environment.production || !environment.isHideGtagLog;
if (isGtag && this.platform.browser() && window?.gtag) {
window.gtag(...args);
}
}
Expand Down
1 change: 1 addition & 0 deletions projects/srm/src/environments/development-env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

export const devEnv: any = {
production: false,
isHideGtagLog: true,
cardsURL: 'https://srm-staging-api.whiletrue.industries/api/idx/search/cards',
// pointsURL: 'https://srm-staging-api.whiletrue.industries/api/idx/search/points',
// countCategoriesURL: 'https://srm-staging-api.whiletrue.industries/api/idx/search/count',
Expand Down
1 change: 1 addition & 0 deletions projects/srm/src/environments/environment.prod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

export const environment = {
production: true,
isHideGtagLog: false,
cardsURL: 'https://api.kolsherut.org.il/api/idx/search/cards',
// pointsURL: 'https://api.kolsherut.org.il/api/idx/search/points',
// countCategoriesURL: 'https://api.kolsherut.org.il/api/idx/search/count',
Expand Down
1 change: 1 addition & 0 deletions projects/srm/src/environments/environment.staging.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { devEnv } from './development-env';

export const environment = Object.assign({}, devEnv, {
isHideGtagLog: false,
// clusterDataURL: '/clusters.json',
// taxonomySituationsURL: '/situations.json',
// taxonomyResponsesURL: '/responses.json'
Expand Down

0 comments on commit 94e6444

Please sign in to comment.