mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-16 18:49:50 +00:00
Use a dimension to note how the user opened squoosh
This commit is contained in:
@@ -13,9 +13,17 @@ if (!('customElements' in self)) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof PRERENDER === 'undefined') {
|
if (typeof PRERENDER === 'undefined') {
|
||||||
|
// Determine the current display mode.
|
||||||
|
let displayMode = 'browser';
|
||||||
|
const mqStandAlone = '(display-mode: standalone)';
|
||||||
|
if (navigator.standalone || window.matchMedia(mqStandAlone).matches) {
|
||||||
|
displayMode = 'standalone';
|
||||||
|
}
|
||||||
|
// Setup analytics
|
||||||
window.ga = window.ga || ((...args) => (ga.q = ga.q || []).push(args));
|
window.ga = window.ga || ((...args) => (ga.q = ga.q || []).push(args));
|
||||||
ga('create', 'UA-128752250-1', 'auto');
|
ga('create', 'UA-128752250-1', 'auto');
|
||||||
ga('set', 'transport', 'beacon');
|
ga('set', 'transport', 'beacon');
|
||||||
|
ga('set', 'dimensionX', displayMode);
|
||||||
ga('send', 'pageview');
|
ga('send', 'pageview');
|
||||||
// Load the GA script
|
// Load the GA script
|
||||||
const s = document.createElement('script');
|
const s = document.createElement('script');
|
||||||
|
|||||||
Reference in New Issue
Block a user