Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download
Views: 39604
1
//- if we have a GA token, insert the google analytics async script
2
- var GOOGLE_ANALYTICS = htmlWebpackPlugin.options.GOOGLE_ANALYTICS
3
if typeof GOOGLE_ANALYTICS !== "undefined" && GOOGLE_ANALYTICS !== null
4
//--- Google Analytics ---
5
script.
6
//- Instructs analytics.js to use the name `google_analytics`.
7
window.GoogleAnalyticsObject = 'google_analytics';
8
//- Creates an initial analytics() function.
9
//- The queued commands will be executed once analytics.js loads.
10
window.google_analytics = window.google_analytics || function() {
11
(google_analytics.q = google_analytics.q || []).push(arguments)
12
};
13
//- Sets the time (as an integer) this tag was executed.
14
//- Used for timing hits.
15
google_analytics.l = +new Date;
16
//- Creates a default tracker with automatic cookie domain configuration.
17
google_analytics('create', '#{GOOGLE_ANALYTICS}', 'auto');
18
//- Sends a pageview hit from the tracker just created.
19
google_analytics('send', 'pageview');
20
21
//- Sets the `async` attribute to load the script asynchronously.
22
script(async src='//www.google-analytics.com/analytics.js')
23
//--- End Google Analytics ---
24