Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
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
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
7edd170e
Commit
7edd170e
authored
Jan 18, 2017
by
Sean Roberts
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Google Analytics if settings supply it
parent
697d50d7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
0 deletions
+38
-0
app.js
src/sidebar/app.js
+5
-0
ga.js
src/sidebar/ga.js
+33
-0
No files found.
src/sidebar/app.js
View file @
7edd170e
'use strict'
;
'use strict'
;
var
queryString
=
require
(
'query-string'
);
var
queryString
=
require
(
'query-string'
);
var
addAnalytics
=
require
(
'./ga'
);
require
(
'../shared/polyfills'
);
require
(
'../shared/polyfills'
);
...
@@ -37,6 +38,10 @@ if (settings.raven) {
...
@@ -37,6 +38,10 @@ if (settings.raven) {
angular
.
module
(
'ngRaven'
,
[]);
angular
.
module
(
'ngRaven'
,
[]);
}
}
if
(
settings
.
googleAnalytics
){
addAnalytics
(
settings
.
googleAnalytics
);
}
// Fetch external state that the app needs before it can run. This includes the
// Fetch external state that the app needs before it can run. This includes the
// authenticated user state, the API endpoint URLs and WebSocket connection.
// authenticated user state, the API endpoint URLs and WebSocket connection.
var
resolve
=
{
var
resolve
=
{
...
...
src/sidebar/ga.js
0 → 100644
View file @
7edd170e
'use strict'
;
let
loaded
=
false
;
module
.
exports
=
function
(
trackingId
){
// small measure to make we do not accidentally
// load the analytics scripts more than once
if
(
loaded
){
return
;
}
loaded
=
true
;
/* eslint-disable */
// Google Analytics snippet to load the analytics 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'
);
ga
(
'create'
,
trackingId
,
'auto'
);
// overrides helper that requires http or https protocols.
// obvious issue when it comes to extensions with protocols
// like "chrome-extension://" but isn't a huge need for us
// anywhere else as well.
// https://developers.google.com/analytics/devguides/collection/analyticsjs/tasks#disabling
ga
(
'set'
,
'checkProtocolTask'
,
null
);
/* eslint-enable */
};
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