Skip to content

Discussion: Adding a description to analytics #29

Description

@JoeyMckenzie

Hi!

First and foremost, I'm loving this package. I've been using it on some Statamic websites I run, and having the analytics is super helpful. I was wondering if there's any possibility we might get the ability to add descriptions to targeted elements for analytics sometime in the future.

I'm thinking of a scenario where I could schedule some commands to run, gather the Pan output, and have them emailed weekly to me and my other partners running these sites. It would be great if we could add descriptive tags to each of the elements in the Pan output, so we can leave "notes" of sort about the element we're targeting.

I've been working on a POC on my own fork of what that change might look like, and didn't necessarily want to PR it before discussing if it makes sense to do for Pan. More than happy to keep my fork available and update as is, as I'd like to report analytics to non-technical folks that don't necessarily want to look at the slugified data attribute tags in the output and would rather have some sort of friendly description of the element.

An example output I've scapped together after all the work and what it would ultimately boil down to:

image

Thanks for all of your work @nunomaduro and @iamdavidhill!

Activity

  1. chrispage1 commented on Nov 12, 2024

    @chrispage1

    I think this could be handy but maybe best suited to be similar to the existing whitelisting - https://github.com/panphp/pan?tab=readme-ov-file#whitelist-your-product-analytics

    So you can define it as below rather than submitting the descriptions via JavaScript.

    PanConfiguration::eventDescriptions([
      'tab-profile' => 'Profile tab on user landing page',
    ])
  2. chrispage1 commented on Nov 12, 2024

    @chrispage1

    @JoeyMckenzie - I've written an implementation of this on server-side only. Of course means there is room for a JS implementation although I worry it might leave it a little bit exposed to exploitation

  3. JoeyMckenzie commented on Nov 12, 2024

    @JoeyMckenzie
    Author

    Yeah, I think that makes sense for the primary concern of keeping the description server-side. My take was more based in the Statamic websites I run, where I have a content manager that could provide the descriptions via blueprint text field or something, and that could be dropped right into an Antlers template. That way, they could modify the descriptions on the fly (though I didn't include any update logic in my POC yet).

    I think it's a good idea to get this in in some form, and I think defaulting to server-side description is the safe bet initially.

  4. chrispage1 commented on Nov 12, 2024

    @chrispage1

    Ah Statamic - how do you find it? I had a go with it but only made one website a while back - a little off topic - sorry!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions