If you are a Cabin Analytics user and want to feature the analytics in your dashboard or manage multiple sites under a single account, I created a plugin.

If you are a Cabin Analytics user (highly recommended) and want to feature analytics on your dashboard, or you manage multiple sites under a single account, I created a plugin that lets you use the API key to display analytics for each site. Here is what you will see.

I had originally created a code snippet to show the data, but opted for a more complete solution.

Originally I started with ChatGPT but it was a struggle for hours. I then went to Telex and in an hour I had a 90% solution and after struggling with the date range for another hour it was complete — learned how the plugin was coded. I went through and made some additional changes that Telex struggled with (styling the admin).

Features

The admin UI before and after my changes.

Default admin settings

The following settings configure the dashboard widget and the defaults for the block and shortcode.

  • API key
  • Custom domain
  • Default view
  • Default date range (last 7,14, 30, or 90 days)
  • Dashboard URL

Block and shortcode

These settings can be set for each block and shortcode instance

  • Custom domain
  • Initial view
  • Initial date range
  • Dashboard URL: You can use the default URL or provide a public dashboard URL.
  • User options: disable front-end users’ ability to change the view or date range.
Image 102
Block settings

Shortcode options

Brackets removed to prevent rendering.

cabin_analytics

With parameters:cabin_analytics domain="example.com" chart_type="line" date_range="30"

Download the plugin, ZIP, 54KB, As Is

Variables for styling

All of the main style have variables so that you can make it match your sites look and feel.

:root 
:root 
CSS