Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onClick={distribution => {
// google analytics download tracking
const resource_url = encodeURIComponent(
distribution.downloadURL
);
if (resource_url) {
gapi.event({
category: "Resource",
action: "Download",
label: resource_url
});
}
}}
href={distribution.downloadURL}
onClick={() => {
// google analytics download tracking
const resource_url = encodeURIComponent(
this.props.distribution
.downloadURL
);
if (resource_url) {
// legacy support
gapi.event({
category: "Resource",
action: "Download",
label: resource_url
});
// new events
gapi.event({
category:
"Download by Dataset",
action: this.props.dataset
.title,
label: resource_url
});
gapi.event({
category:
"Download by Source",
action: this.props.dataset
.source,
label: resource_url
});
gapi.event({
category:
"Download by Publisher",
updateGAEvent(props) {
if (
props.dataset &&
props.dataset.identifier !== this.props.dataset.identifier
) {
if (this.props.dataset.source !== "") {
gapi.event({
category: "Dataset view by Source",
action: this.props.dataset.source,
label: this.props.dataset.title
});
}
if (this.props.dataset.publisher.name !== "") {
gapi.event({
category: "Dataset view by Publisher",
action: this.props.dataset.publisher.name,
label: this.props.dataset.title
});
}
}
}
onRevealButtonClick = () => {
gapi.event({
category: "User Engagement",
action: "Dataset Contact Point Reveal",
label: this.props.contactPoint
});
this.setState({
reveal: true
});
};
isSending: false
};
});
if (this.props.formSubmitState) {
this.props.formSubmitState(true);
}
} else {
this.setState(() => {
return {
successResult: true,
posted: true,
isSending: false
};
});
gapi.event({
category: "User Engagement",
action:
this.props.requestType === "request"
? "Data Request"
: "Dataset Feedback",
label: this.props.datasetId
});
this.handleChange(data);
if (this.props.formSubmitState) {
this.props.formSubmitState(true);
}
}
})
.catch(error => {
updateGAEvent(props) {
if (
props.dataset &&
props.dataset.identifier !== this.props.dataset.identifier
) {
if (this.props.dataset.source !== "") {
gapi.event({
category: "Dataset view by Source",
action: this.props.dataset.source,
label: this.props.dataset.title
});
}
if (this.props.dataset.publisher.name !== "") {
gapi.event({
category: "Dataset view by Publisher",
action: this.props.dataset.publisher.name,
label: this.props.dataset.title
});
}
}
}