Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
ce4010e52b |
@ -58,6 +58,16 @@ export default class Results extends Component<Props, State> {
|
|||||||
this.props.onCopyToOtherClick();
|
this.props.onCopyToOtherClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@bind
|
||||||
|
onDownload() {
|
||||||
|
ga('send', 'event', 'compression', 'download', {
|
||||||
|
// GA can’t do floats. So we round to ints.
|
||||||
|
metric1: Math.floor(this.props.source!.file.size),
|
||||||
|
metric2: Math.floor(this.props.imageFile!.size),
|
||||||
|
metric3: Math.floor(this.props.imageFile!.size / this.props.source!.file.size * 1000),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
render(
|
render(
|
||||||
{ source, imageFile, downloadUrl, children, copyDirection, buttonPosition }: Props,
|
{ source, imageFile, downloadUrl, children, copyDirection, buttonPosition }: Props,
|
||||||
{ showLoadingState }: State,
|
{ showLoadingState }: State,
|
||||||
@ -93,6 +103,7 @@ export default class Results extends Component<Props, State> {
|
|||||||
href={downloadUrl}
|
href={downloadUrl}
|
||||||
download={imageFile.name}
|
download={imageFile.name}
|
||||||
title="Download"
|
title="Download"
|
||||||
|
onClick={this.onDownload}
|
||||||
>
|
>
|
||||||
<DownloadIcon class={style.downloadIcon} />
|
<DownloadIcon class={style.downloadIcon} />
|
||||||
</a>
|
</a>
|
||||||
|
@ -12,3 +12,12 @@ if (!('customElements' in self)) {
|
|||||||
} else {
|
} else {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.ga = window.ga || ((...args) => (ga.q = ga.q || []).push(args));
|
||||||
|
ga('create', 'UA-128752250-1', 'auto');
|
||||||
|
ga('set', 'transport', 'beacon');
|
||||||
|
ga('send', 'pageview');
|
||||||
|
// Load the GA script
|
||||||
|
const s = document.createElement('script');
|
||||||
|
s.src = 'https://www.google-analytics.com/analytics.js';
|
||||||
|
document.head!.appendChild(s);
|
||||||
|
9
src/missing-types.d.ts
vendored
9
src/missing-types.d.ts
vendored
@ -34,3 +34,12 @@ declare module 'url-loader!*' {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare var VERSION: string;
|
declare var VERSION: string;
|
||||||
|
|
||||||
|
declare var ga: {
|
||||||
|
(...args: any[]): void;
|
||||||
|
q: any[];
|
||||||
|
};
|
||||||
|
|
||||||
|
interface Window {
|
||||||
|
ga: typeof ga;
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user