Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
enasequence
webin-portal
Commits
67db7b30
Commit
67db7b30
authored
Jan 17, 2022
by
Rajkumar-D
Browse files
Adding user-Id for google analytics
parent
183337fb
Pipeline
#278449
passed with stages
in 5 minutes and 7 seconds
Changes
3
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
7 deletions
+24
-7
src/app/app.component.ts
src/app/app.component.ts
+17
-7
src/app/login/login.component.ts
src/app/login/login.component.ts
+2
-0
src/app/webin-authentication.service.ts
src/app/webin-authentication.service.ts
+5
-0
No files found.
src/app/app.component.ts
View file @
67db7b30
...
...
@@ -12,6 +12,7 @@
import
{
Component
}
from
'
@angular/core
'
;
import
{
Router
,
NavigationEnd
}
from
'
@angular/router
'
;
import
{
environment
}
from
'
../environments/environment
'
;
import
{
WebinAuthenticationService
}
from
'
./webin-authentication.service
'
;
declare
let
gtag
:
Function
;
@
Component
({
...
...
@@ -22,7 +23,8 @@ declare let gtag: Function;
export
class
AppComponent
{
title
=
'
Webin
'
;
constructor
(
public
router
:
Router
)
{
constructor
(
public
router
:
Router
,
private
_webinAuthService
:
WebinAuthenticationService
)
{
// Adding code for Google Analytics
if
(
environment
.
googleAnalyticsTrackingId
)
{
// register google tag manager
...
...
@@ -41,20 +43,28 @@ export class AppComponent {
document
.
head
.
appendChild
(
gaScript
);
}
// Triggering route event.
// Triggering route event
for Google Analytics
.
this
.
router
.
events
.
subscribe
(
event
=>
{
var
submissionAccount
=
JSON
.
parse
(
this
.
_webinAuthService
.
getSubmissionAccount
());
if
(
event
instanceof
NavigationEnd
)
{
gtag
(
'
config
'
,
environment
.
googleAnalyticsTrackingId
,
{
'
page_path
'
:
event
.
urlAfterRedirects
,
'
page_location
'
:
event
.
url
'
page_location
'
:
event
.
url
,
'
user_id
'
:
submissionAccount
?
submissionAccount
.
id
:
""
}
);
if
(
submissionAccount
)
{
gtag
(
'
set
'
,
'
user_properties
'
,
{
'
submission_account_id
'
:
submissionAccount
.
id
});
}
}
}
)
})
}
}
src/app/login/login.component.ts
View file @
67db7b30
...
...
@@ -77,6 +77,8 @@ export class LoginComponent implements OnInit {
this
.
_router
.
navigateByUrl
(
''
);
if
(
!
this
.
_webinAuthenticationService
.
ega
)
{
this
.
_webinAuthenticationService
.
setSubmissionAccount
();
}
else
{
this
.
_webinAuthenticationService
.
setEgaSubmissionAccount
();
}
}
},
...
...
src/app/webin-authentication.service.ts
View file @
67db7b30
...
...
@@ -162,6 +162,11 @@ export class WebinAuthenticationService implements WebinAuthenticationServiceInt
});
}
setEgaSubmissionAccount
()
{
// For Google analytics
sessionStorage
.
setItem
(
'
submissionAccount
'
,
'
{"id":"
'
+
this
.
username
+
'
"}
'
);
}
isBroker
():
boolean
{
var
submissionAccount
=
JSON
.
parse
(
sessionStorage
.
getItem
(
'
submissionAccount
'
)
...
...
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