Skip to content

Make images smaller using best-in-class codecs, right in the browser.

JavaScript

Updates to analytics for PWAs (#772)

Pete LePage8a516131ea49
diff --git a/src/components/intro/index.tsx b/src/components/intro/index.tsx
index 7695ee73..393788c8 100644
--- a/src/components/intro/index.tsx
+++ b/src/components/intro/index.tsx
@@ -41,7 +41,7 @@ const demos = [
},
];
-const installButtonSource = 'introInstallButton';
+const installButtonSource = 'introInstallButton-Purple';
interface Props {
onFile: (file: File | Fileish) => void;
@@ -113,7 +113,12 @@ export default class Intro extends Component<Props, State> {
this.setState({ beforeInstallEvent: event });
// Log the event.
- ga('send', 'event', 'pwa-install', 'available');
+ const gaEventInfo = {
+ eventCategory: 'pwa-install',
+ eventAction: 'promo-shown',
+ nonInteraction: true,
+ };
+ ga('send', 'event', gaEventInfo);
}
@bind
@@ -130,7 +135,14 @@ export default class Intro extends Component<Props, State> {
// Wait for the user to accept or dismiss the install prompt
const { outcome } = await beforeInstallEvent.userChoice;
- ga('send', 'event', 'pwa-install', installButtonSource, outcome);
+ // Send the analytics data
+ const gaEventInfo = {
+ eventCategory: 'pwa-install',
+ eventAction: 'promo-clicked',
+ eventLabel: installButtonSource,
+ eventValue: outcome === 'accepted' ? 1 : 0,
+ };
+ ga('send', 'event', gaEventInfo);
// If the prompt was dismissed, we aren't going to install via the button.
if (outcome === 'dismissed') {
diff --git a/src/components/intro/style.scss b/src/components/intro/style.scss
index 3c8a138b..4bda5b48 100644
--- a/src/components/intro/style.scss
+++ b/src/components/intro/style.scss
@@ -175,11 +175,12 @@
&:hover,
&:focus {
- background: #f5f5f5;
+ background: #504488;
}
- background: #fff;
+ background: #5D509E;
border: 1px solid #e8e8e8;
+ color: #fff;
padding: 14px;
font-size: 1.3rem;
diff --git a/src/manifest.json b/src/manifest.json
index 8fee6310..605af071 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,7 +1,7 @@
{
"name": "Squoosh",
"short_name": "Squoosh",
- "start_url": "/",
+ "start_url": "/?utm_medium=PWA&utm_source=launcher",
"display": "standalone",
"orientation": "any",
"background_color": "#fff",
@@ -20,7 +20,7 @@
}
],
"share_target": {
- "action": "/?share-target",
+ "action": "/?utm_medium=PWA&utm_source=share-target&share-target",
"method": "POST",
"enctype": "multipart/form-data",
"params": {