Skip to content

Filter on whether a path is an event in the dashboard. #842

@GeoWill

Description

@GeoWill

Thanks for this project, it's very nice to use 🙂 .

I recently added two events to a page. At a high level it is to let us check whether we had any information to show the user.

Actual code
    <script>
        const postElectionsCount = JSON.parse(document.getElementById('postElectionsCount').textContent);

        function trackElectionsShownEvent(postElectionsCount) {
            const hasElections = postElectionsCount > 0;
            const eventData = hasElections ? {
                path: 'POSTCODE_SEARCH_ELECTION_SHOWN',
                title: 'Postcode search user had an election',
                event: true,
            } : {
                path: 'POSTCODE_SEARCH_NO_ELECTION_SHOWN',
                title: 'Postcode search user had no election',
                event: true,
            };

            window.goatcounter.count(eventData);
        }

        document.addEventListener('DOMContentLoaded', function() {
            trackElectionsShownEvent(postElectionsCount);
        });
    </script>

These events are fired on pages with different paths. So, if I understand correctly, a visit to a given page will fire off two counts to goat counter, one where the path corresponds to the page url, and another for the event triggered by the js. In the dashboard I can see counts for the pages visited and the event path. I think this means on the dashboard our totals now include a double count in terms of actual visitors.

Is there a way for us to filter out events for when we're just looking at figures on the dashboard? I didn't see anything in the UI. Ideally I want to be able to easily check the number of visitors to a page, or set of pages, without including the events that they also triggered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions