Skip to content

Commit

Permalink
test: add examples events for upload within admin
Browse files Browse the repository at this point in the history
  • Loading branch information
mattystank committed Jul 18, 2024
1 parent d38d1c9 commit 56ba1ba
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion src/app/components/upload/upload-listings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,28 @@ function ChplUploadListings() {
setFile(event.target.files[0]);
setEle(event.target);
};

const UploadListing = () => {
if (typeof window.gtag === 'function') {
window.gtag('event', 'Upload', {
event_category: 'Administrative',
event_label: 'Listing Upload',
})
}
}
const RemoveListing = () => {
if (typeof window.gtag === 'function') {
window.gtag('event', 'Remove Upload', {
event_category: 'Administrative',
})
}
}
const SubmitListing = () => {
if (typeof window.gtag === 'function') {
window.gtag('event', 'Submit Upload', {
event_category: 'Administrative',
})
}
}
const uploadFile = () => {
const item = {
url: `${API}/listings/upload`,
Expand Down Expand Up @@ -143,6 +164,7 @@ function ChplUploadListings() {
type="file"
id="upload-file-selector"
onChange={onFileChange}
onClick={UploadListing}
style={{ display: 'none' }}
/>
</Button>
Expand Down Expand Up @@ -172,6 +194,7 @@ function ChplUploadListings() {
color="primary"
variant="contained"
onClick={uploadFile}
onClickCapture={SubmitListing}
endIcon={<DoneIcon />}
id="submit-upload-file"
>
Expand All @@ -181,6 +204,7 @@ function ChplUploadListings() {
className={classes.deleteButton}
variant="contained"
onClick={clearFile}
onClickCapture={RemoveListing}
endIcon={<DeleteIcon />}
id="clear-upload-file"
>
Expand Down

0 comments on commit 56ba1ba

Please sign in to comment.