Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Dspace7 Angular
Manage
Activity
Members
Labels
Plan
Issues
42
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
vtechworks
Dspace7 Angular
Commits
dafe30f3
Commit
dafe30f3
authored
7 years ago
by
Kristof De Langhe
Browse files
Options
Downloads
Patches
Plain Diff
50479: Google analytics only loaded when tracking id present
parent
062f0f1a
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/index.csr.html
+0
-6
0 additions, 6 deletions
src/index.csr.html
src/index.html
+0
-6
0 additions, 6 deletions
src/index.html
src/main.browser.ts
+15
-4
15 additions, 4 deletions
src/main.browser.ts
with
15 additions
and
16 deletions
src/index.csr.html
+
0
−
6
View file @
dafe30f3
...
...
@@ -10,12 +10,6 @@
</head>
<body>
<script>
(
function
(
i
,
s
,
o
,
g
,
r
,
a
,
m
){
i
[
'
GoogleAnalyticsObject
'
]
=
r
;
i
[
r
]
=
i
[
r
]
||
function
(){
(
i
[
r
].
q
=
i
[
r
].
q
||
[]).
push
(
arguments
)},
i
[
r
].
l
=
1
*
new
Date
();
a
=
s
.
createElement
(
o
),
m
=
s
.
getElementsByTagName
(
o
)[
0
];
a
.
async
=
1
;
a
.
src
=
g
;
m
.
parentNode
.
insertBefore
(
a
,
m
)
})(
window
,
document
,
'
script
'
,
'
https://www.google-analytics.com/analytics.js
'
,
'
ga
'
);
</script>
<ds-app></ds-app>
</body>
...
...
This diff is collapsed.
Click to expand it.
src/index.html
+
0
−
6
View file @
dafe30f3
...
...
@@ -10,12 +10,6 @@
</head>
<body>
<script>
(
function
(
i
,
s
,
o
,
g
,
r
,
a
,
m
){
i
[
'
GoogleAnalyticsObject
'
]
=
r
;
i
[
r
]
=
i
[
r
]
||
function
(){
(
i
[
r
].
q
=
i
[
r
].
q
||
[]).
push
(
arguments
)},
i
[
r
].
l
=
1
*
new
Date
();
a
=
s
.
createElement
(
o
),
m
=
s
.
getElementsByTagName
(
o
)[
0
];
a
.
async
=
1
;
a
.
src
=
g
;
m
.
parentNode
.
insertBefore
(
a
,
m
)
})(
window
,
document
,
'
script
'
,
'
https://www.google-analytics.com/analytics.js
'
,
'
ga
'
);
</script>
<ds-app></ds-app>
</body>
...
...
This diff is collapsed.
Click to expand it.
src/main.browser.ts
+
15
−
4
View file @
dafe30f3
...
...
@@ -25,14 +25,25 @@ export function main() {
}
});
// Add google analytics key
const
script
=
document
.
createElement
(
'
script
'
);
script
.
innerHTML
=
'
ga(
\'
create
\'
,
\'
'
+
ENV_CONFIG
.
gaTrackingId
+
'
\'
,
\'
auto
\'
);
'
;
document
.
body
.
appendChild
(
script
);
addGoogleAnalytics
();
return
platformBrowserDynamic
().
bootstrapModule
(
BrowserAppModule
);
}
function
addGoogleAnalytics
()
{
// Add google analytics if key is present in config
const
trackingId
=
ENV_CONFIG
.
gaTrackingId
;
if
(
trackingId
!==
''
&&
trackingId
!==
null
)
{
const
keyScript
=
document
.
createElement
(
'
script
'
);
keyScript
.
innerHTML
=
`(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');`
+
'
ga(
\'
create
\'
,
\'
'
+
ENV_CONFIG
.
gaTrackingId
+
'
\'
,
\'
auto
\'
);
'
;
document
.
body
.
appendChild
(
keyScript
);
}
}
// support async tag or hmr
if
(
hasValue
(
ENV_CONFIG
.
universal
)
&&
ENV_CONFIG
.
universal
.
preboot
===
false
)
{
bootloader
(
main
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment