Problem/Motivation

It's possible to embed your Plausible dashboard using an iframe. We could provide an admin route and menu link with this embed for easy access to analytics from within the cms.

Proposed resolution

An admin route, menu link and a new setting where the embed url can be entered.

Path: /admin/reports/plausible-analytics
Page title: Plausible Analytics
Page default content: Embed your Plausible Analytics dashboard by following these instructions.

CommentFileSizeAuthor
#11 image (4).png71.27 KBsrdtwc

Issue fork plausible-3232308

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

DieterHolvoet created an issue. See original summary.

cedewey’s picture

Version: 8.x-1.x-dev » 2.x-dev
Issue summary: View changes

This is a great idea. I've added some detail to the proposed resolution.

dieterholvoet’s picture

Before anyone starts working on this, I have a basic implementation ready in a custom project we could use as a base.

srdtwc’s picture

@DieterHolvoet that would be great to see. I am hoping to have this done in the next couple of weeks if you are able to share what you have.

dieterholvoet’s picture

Here's the custom controller I have in my project: https://gist.github.com/DieterHolvoet/1804206bde05a3a2bed93925a5fc2071
The part reading Gin settings is for matching the embed theme with the Gin theme light/dark mode. Instead of providing the ability to paste the whole embed HTML, I would add a field for the auth code and build the embed yourself as in my example. The result will look better.

srdtwc’s picture

Thanks for sharing! That's exactly the approach I was going to take, but I didn't think of using the light/dark settings from Gin. That's a nice touch.

I'll let you know if I have any questions

dieterholvoet’s picture

It might be a good idea to develop this with #3361729: Add a block with an embed of the Plausible dashboard in mind, e.g. by abstracting away the embed building in a custom element that we can use in both use cases.

srdtwc’s picture

I've opened a merge request with this feature in place.

I've kept it pretty simple for now to make sure the basic functionality works.

dieterholvoet’s picture

Status: Active » Needs work

Looks good! Didn't test it yet, but added some comments in the MR. Setting to Needs work.

srdtwc’s picture

StatusFileSize
new71.27 KB

Here is where I got the "system" setting

screenshot from plausible website

srdtwc’s picture

I chose to have the full "Shared link" instead of just the auth param because I thought that would be more user friendly. Plausible provides the full Shared Link, so someone can just copy/paste that into the module settings, rather than having to copy just the auth param component. That could be difficult for a non-technical user who doesn't know what that is.

We have many clients who are switching from Google Analytics to Plausible for its user friendliness so that's something I'd like to keep in mind.

dieterholvoet’s picture

You're right, the system value is correct. Must have got that wrong earlier and never noticed it. You're right about it being more user friendly to copy/paste the whole Shared url, I didn't think about that before.

srdtwc’s picture

I have made the changes that you've requested as far as I've understood them. Sorry If there's anything I've missed.

The time I have been spending on this has come from a client project budget which is limited, so I don't think I am able to spend more time making feature enhancements. If you find any bugs in my code though I would be happy to address those.

dieterholvoet’s picture

Status: Needs work » Needs review

@srdtwc could you give this a last round of testing before I merge it?

srdtwc’s picture

I just tested these changes out and everything appears to be working fine. I tried removing and adding a shared link, adding an invalid link, viewing the shared link route when no link was set and all behaviors are as expected.

Thank you for your assistance with this.

srdtwc’s picture

Status: Needs review » Reviewed & tested by the community

  • DieterHolvoet committed 78f16173 on 2.x authored by srdtwc
    Issue #3232308 by srdtwc, DieterHolvoet: Add an admin page with an embed...
dieterholvoet’s picture

Status: Reviewed & tested by the community » Fixed
dieterholvoet’s picture

Thank you for the effort!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.