Added first round of analytics and event tracking BOD-190

This commit is contained in:
Patrick Fic
2020-07-17 08:27:28 -07:00
parent 3f0394760a
commit a54a85b96c
73 changed files with 433 additions and 208 deletions

View File

@@ -2,11 +2,14 @@ import { Button } from "antd";
import axios from "axios";
import React from "react";
import { useTranslation } from "react-i18next";
import { logImEXEvent } from "../../firebase/firebase.utils";
export default function JobsDocumentsDownloadButton({ galleryImages }) {
const { t } = useTranslation();
const imagesToDownload = galleryImages.filter((image) => image.isSelected);
const handleDelete = () => {
const handleDownload = () => {
logImEXEvent("jobs_documents_download");
axios
.post("/media/download", {
ids: imagesToDownload.map((_) => _.key),
@@ -17,7 +20,7 @@ export default function JobsDocumentsDownloadButton({ galleryImages }) {
};
return (
<Button disabled={imagesToDownload.length < 1} onClick={handleDelete}>
<Button disabled={imagesToDownload.length < 1} onClick={handleDownload}>
{t("documents.actions.download")}
</Button>
);

View File

@@ -4,6 +4,7 @@ import { useTranslation } from "react-i18next";
import axios from "axios";
import { useMutation } from "@apollo/react-hooks";
import { DELETE_DOCUMENT } from "../../graphql/documents.queries";
import { logImEXEvent } from "../../firebase/firebase.utils";
export default function JobsDocumentsDeleteButton({
galleryImages,
@@ -13,6 +14,8 @@ export default function JobsDocumentsDeleteButton({
const [deleteDocument] = useMutation(DELETE_DOCUMENT);
const imagesToDelete = galleryImages.filter((image) => image.isSelected);
const handleDelete = () => {
logImEXEvent("job_documents_delete", { count: imagesToDelete.length });
imagesToDelete.forEach((image) => {
let timestamp = Math.floor(Date.now() / 1000);
let public_id = image.key;