Using custom event goals and custom props to track downloads

Hi there,

I’ve tried to follow the documentation on how to set up a custom event goal, but the current approach doesn’t seem to be working as I’d hoped.

I’m trying to set a custom event to track clicks of a download button and I’d like to pass the href attribute value of the button to Plausible so I can see which file has been clicked.

I’ve tried adding the following function to fire on a click event:

plausibleEvent (e) {
        const $elem = $(e.currentTarget);
        plausible('Download', {props: {file: $elem.attr('href')}});
    }

I can see a Download event in the dashboard, but no sign of the custom prop. Could you let me know firstly whether this sort of tracking is possible and secondly why the current approach would not pass through to the dashboard.

Many thanks,
Stuart

Hey, I guess you’re self-hosting?

We haven’t cut a release with custom event props yet. Check out our changelog:

Everything in the [1.1.2] - Unreleased section is not included in the latest docker image. You can access it through the unstable dev tag on Dockerhub instead.

Hi uku,

Thanks for your reply!

Currently not self-hosting anything, as far as I can tell the website is using a completely standard set-up using the following:

<script async defer data-domain="thedomain.org" src="https://plausible.io/js/plausible.outbound-links.js"></script>
    <script>window.plausible = window.plausible || function () {
            (window.plausible.q = window.plausible.q || []).push(arguments)
        }</script>

Maybe I’m confused why there is the section on custom event goals in the docs if it’s functionality that isn’t yet available? Or is that something different?

Your setup looks correct to me, it should work. Do you mind sharing the URL and instructons on how to trigger the Download event so I can debug it? You can send it to uku@plausible.io if you don’t want to share on a public forum

Sure, no problem. I’ll send you an email separately, thanks!

Scrap that, it now appears to be working! The site only launched yesterday so maybe there was a teething problem somewhere. Anyway, the above code is pulling through the file URL as a custom property, so that’s working as expected. Thanks for your support.

1 Like