• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mozilla / blurts-server / #13207

pending completion
#13207

push

circleci

toufali
use ESBuild to define env vars in client

282 of 1633 branches covered (17.27%)

Branch coverage included in aggregate %.

13 of 13 new or added lines in 2 files covered. (100.0%)

959 of 4397 relevant lines covered (21.81%)

1.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/client/js/analytics.js
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4

5
import AppConstants from './app-constants.js'
6

7
const debugMode = AppConstants.NODE_ENV !== 'production'
×
8

9
if (navigator.doNotTrack === '1') {
×
10
  window.gtag = function () {
×
11
    console.debug('Google Analytics disabled by DNT')
×
12
  }
13
  window.gtag()
×
14
} else {
15
  await import(`https://www.googletagmanager.com/gtag/js?id=${AppConstants.GA4_MEASUREMENT_ID}`)
×
16

17
  window.dataLayer = window.dataLayer || []
×
18

19
  window.gtag = function () {
×
20
    window.dataLayer.push(arguments)
×
21
  }
22
  window.gtag('js', new Date())
×
23
  window.gtag('config', AppConstants.GA4_MEASUREMENT_ID, {
×
24
    cookie_domain: window.location.hostname,
25
    cookie_flags: 'SameSite=None;Secure',
26
    debug_mode: debugMode
27
  })
28

29
  // Instrument CTA clicks for analytics.
30
  document.querySelectorAll('[data-cta-id]').forEach(cta =>
×
31
    cta.addEventListener('click', () => window.gtag('event', 'clicked_cta', { cta_id: cta.dataset.ctaId })))
×
32
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc