How to use the analytics/ga.gapi.event function in analytics

To help you get started, we’ve selected a few analytics examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github magda-io / magda / magda-web-client / src / Components / Dataset / View / DistributionDetails.js View on Github external
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}
github magda-io / magda / magda-web-client / src / Components / Dataset / DatasetPage.js View on Github external
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",
github magda-io / magda / magda-web-client / src / Components / Dataset / DatasetPage.js View on Github external
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
                });
            }
        }
    }
github magda-io / magda / magda-web-client / src / Components / Common / ContactPoint.js View on Github external
onRevealButtonClick = () => {
        gapi.event({
            category: "User Engagement",
            action: "Dataset Contact Point Reveal",
            label: this.props.contactPoint
        });
        this.setState({
            reveal: true
        });
    };
github magda-io / magda / magda-web-client / src / Components / Dataset / Suggest / RequestFormLogic.js View on Github external
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 => {
github magda-io / magda / magda-web-client / src / Components / Dataset / DatasetPage.js View on Github external
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
                });
            }
        }
    }