Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
PERFORMA_REPLICA
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Muhammad Usman
PERFORMA_REPLICA
Commits
4f487f18
Commit
4f487f18
authored
Mar 19, 2020
by
Harsh Shah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
google tag manager service added, todo - add proper datalayer values
parent
6aedd51d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
91 additions
and
4 deletions
+91
-4
app.module.ts
frontend/angular/src/app/app.module.ts
+3
-1
admin-portal-layout.component.ts
...rtal/admin-portal-layout/admin-portal-layout.component.ts
+8
-1
google-tag-manager.service.ts
...nd/angular/src/app/services/google-tag-manager.service.ts
+76
-0
environment.prod.ts
frontend/angular/src/environments/environment.prod.ts
+2
-1
environment.ts
frontend/angular/src/environments/environment.ts
+2
-1
No files found.
frontend/angular/src/app/app.module.ts
View file @
4f487f18
...
@@ -36,6 +36,7 @@ import { OneITModule } from './oneit/oneit.module';
...
@@ -36,6 +36,7 @@ import { OneITModule } from './oneit/oneit.module';
import
{
SearchApplicantsComponent
}
from
'./components/search-applicants/search-applicants.component'
;
import
{
SearchApplicantsComponent
}
from
'./components/search-applicants/search-applicants.component'
;
import
{
SearchApplicantService
}
from
'./components/search-applicants/search-applicants.service'
;
import
{
SearchApplicantService
}
from
'./components/search-applicants/search-applicants.service'
;
import
{
EditApplicantComponent
}
from
'./components/edit-applicant/edit-applicant.component'
;
import
{
EditApplicantComponent
}
from
'./components/edit-applicant/edit-applicant.component'
;
import
{
GoogleTagManagerService
}
from
'./services/google-tag-manager.service'
;
@
NgModule
({
@
NgModule
({
imports
:
[
imports
:
[
...
@@ -78,7 +79,8 @@ import { EditApplicantComponent } from './components/edit-applicant/edit-applica
...
@@ -78,7 +79,8 @@ import { EditApplicantComponent } from './components/edit-applicant/edit-applica
EditWorkflowTemplateService
,
EditWorkflowTemplateService
,
MessageEngineService
,
MessageEngineService
,
DatePipe
,
DatePipe
,
SearchApplicantService
SearchApplicantService
,
GoogleTagManagerService
],
],
bootstrap
:
[
AppComponent
]
bootstrap
:
[
AppComponent
]
})
})
...
...
frontend/angular/src/app/components/admin-portal/admin-portal-layout/admin-portal-layout.component.ts
View file @
4f487f18
...
@@ -11,6 +11,7 @@ import { IframeMsgHandlingService } from '../../../oneit/services/iframe-msg-han
...
@@ -11,6 +11,7 @@ import { IframeMsgHandlingService } from '../../../oneit/services/iframe-msg-han
import
{
MsgsService
}
from
'../../../oneit/services/msgs.service'
;
import
{
MsgsService
}
from
'../../../oneit/services/msgs.service'
;
import
{
UserService
}
from
'../../../oneit/services/user.service'
;
import
{
UserService
}
from
'../../../oneit/services/user.service'
;
import
{
UtilsService
}
from
'../../../oneit/services/utils.service'
;
import
{
UtilsService
}
from
'../../../oneit/services/utils.service'
;
import
{
GoogleTagManagerService
}
from
'../../../services/google-tag-manager.service'
;
import
{
AdminPortalLayoutService
}
from
'./admin-portal-layout.service'
;
import
{
AdminPortalLayoutService
}
from
'./admin-portal-layout.service'
;
@
Component
({
@
Component
({
...
@@ -59,7 +60,8 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
...
@@ -59,7 +60,8 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
private
router
:
Router
,
private
router
:
Router
,
private
modalService
:
BsModalService
,
private
modalService
:
BsModalService
,
private
iframeMsgHandlingService
:
IframeMsgHandlingService
,
private
iframeMsgHandlingService
:
IframeMsgHandlingService
,
private
changeDetector
:
ChangeDetectorRef
private
changeDetector
:
ChangeDetectorRef
,
private
googleTagManagerService
:
GoogleTagManagerService
)
{
)
{
}
}
...
@@ -163,6 +165,11 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
...
@@ -163,6 +165,11 @@ export class AdminPortalLayoutComponent implements OnInit, OnDestroy {
}
else
{
}
else
{
this
.
titleService
.
setTitle
(
'Matchd'
);
this
.
titleService
.
setTitle
(
'Matchd'
);
}
}
//todo change this code, and also call this when hiring team is modified
this
.
googleTagManagerService
.
pushTag
({
userId
:
'test'
,
stripeId
:
'test'
});
},
},
error
=>
{
error
=>
{
this
.
utilsService
.
handleError
(
error
);
this
.
utilsService
.
handleError
(
error
);
...
...
frontend/angular/src/app/services/google-tag-manager.service.ts
0 → 100644
View file @
4f487f18
import
{
Injectable
}
from
'@angular/core'
;
import
{
environment
}
from
'../../environments/environment'
;
//Code copied from https://github.com/mzuccaroli/angular-google-tag-manager/blob/master/projects/angular-google-tag-manager/src/lib/angular-google-tag-manager.service.ts
@
Injectable
()
export
class
GoogleTagManagerService
{
private
isLoaded
=
false
;
private
gtmId
:
string
;
private
browserGlobals
=
{
windowRef
():
any
{
return
window
;
},
documentRef
():
any
{
return
document
;
}
};
constructor
(
)
{
this
.
gtmId
=
environment
.
gtmKey
;
}
public
getDataLayer
()
{
const
window
=
this
.
browserGlobals
.
windowRef
();
window
[
'dataLayer'
]
=
window
[
'dataLayer'
]
||
[];
return
window
[
'dataLayer'
];
}
private
clearDataLayer
()
{
const
window
=
this
.
browserGlobals
.
windowRef
();
window
[
'dataLayer'
]
=
[{
'gtm.start'
:
new
Date
().
getTime
(),
event
:
'gtm.js'
}];
}
private
pushOnDataLayer
(
obj
:
object
)
{
const
dataLayer
=
this
.
getDataLayer
();
dataLayer
.
push
(
obj
);
}
public
addGtmToDom
()
{
const
doc
=
this
.
browserGlobals
.
documentRef
();
const
gtmScript
=
doc
.
createElement
(
'script'
);
gtmScript
.
id
=
'GTMscript'
;
gtmScript
.
async
=
true
;
gtmScript
.
src
=
'//www.googletagmanager.com/gtm.js?id='
+
this
.
gtmId
;
doc
.
head
.
insertBefore
(
gtmScript
,
doc
.
head
.
firstChild
);
const
ifrm
=
doc
.
createElement
(
'iframe'
);
ifrm
.
setAttribute
(
'src'
,
'//www.googletagmanager.com/ns.html?id='
+
this
.
gtmId
);
ifrm
.
style
.
width
=
'0'
;
ifrm
.
style
.
height
=
'0'
;
ifrm
.
style
.
display
=
'none'
;
ifrm
.
style
.
visibility
=
'hidden'
;
const
noscript
=
doc
.
createElement
(
'noscript'
);
noscript
.
id
=
'GTMiframe'
;
noscript
.
appendChild
(
ifrm
);
doc
.
body
.
insertBefore
(
noscript
,
doc
.
body
.
firstChild
);
this
.
isLoaded
=
true
;
}
public
pushTag
(
item
:
object
)
{
this
.
clearDataLayer
();
if
(
!
this
.
isLoaded
)
{
this
.
addGtmToDom
();
}
this
.
pushOnDataLayer
(
item
);
}
}
\ No newline at end of file
frontend/angular/src/environments/environment.prod.ts
View file @
4f487f18
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
export
const
environment
=
{
export
const
environment
=
{
production
:
true
,
production
:
true
,
baseUrl
:
'/'
,
baseUrl
:
'/'
,
envName
:
'PRODUCTION'
envName
:
'PRODUCTION'
,
gtmKey
:
'GTM-WFZ4NVT'
};
};
frontend/angular/src/environments/environment.ts
View file @
4f487f18
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
export
const
environment
=
{
export
const
environment
=
{
production
:
false
,
production
:
false
,
baseUrl
:
'http://vm4.qa03.oneit.com.au/matchd/'
,
baseUrl
:
'http://vm4.qa03.oneit.com.au/matchd/'
,
envName
:
'QA'
envName
:
'QA'
,
gtmKey
:
'GTM-M6M4SW6'
};
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment