Implements privacy-friendly web analytics with Plausible as a Google Analytics alternative. Use when adding lightweight, cookie-free analytics that are GDPR compliant without consent banners.
Adds privacy-friendly web analytics with Plausible as a Google Analytics alternative. Use when implementing lightweight, cookie-free analytics that are GDPR compliant without consent banners.
/plugin marketplace add mgd34msu/goodvibes-plugin/plugin install goodvibes@goodvibes-marketThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Lightweight, open source, privacy-friendly Google Analytics alternative. Cookie-free, GDPR compliant, and under 1KB script size.
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
npm install @plausible-analytics/tracker
import Plausible from '@plausible-analytics/tracker';
const plausible = Plausible({
domain: 'yourdomain.com',
});
// Enable automatic pageview tracking
plausible.enableAutoPageviews();
// app/layout.tsx
import Script from 'next/script';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<Script
defer
data-domain="yourdomain.com"
src="https://plausible.io/js/script.js"
/>
</head>
<body>{children}</body>
</html>
);
}
npm install next-plausible
// app/layout.tsx
import PlausibleProvider from 'next-plausible';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<head>
<PlausibleProvider domain="yourdomain.com" />
</head>
<body>{children}</body>
</html>
);
}
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
<script>
window.plausible = window.plausible || function() {
(window.plausible.q = window.plausible.q || []).push(arguments);
};
</script>
<button onclick="plausible('Signup')">Sign Up</button>
import Plausible from '@plausible-analytics/tracker';
const plausible = Plausible({
domain: 'yourdomain.com',
});
// Track custom event
plausible.trackEvent('signup', {
props: {
plan: 'pro',
source: 'homepage',
},
});
// Track with callback
plausible.trackEvent('purchase', {
props: { product: 'Widget' },
callback: () => {
console.log('Event tracked successfully');
},
});
'use client';
import { usePlausible } from 'next-plausible';
function SignupButton() {
const plausible = usePlausible();
const handleSignup = () => {
plausible('signup', {
props: { plan: 'pro' },
});
// Continue with signup...
};
return <button onClick={handleSignup}>Sign Up</button>;
}
Track ecommerce revenue with custom events.
plausible.trackEvent('purchase', {
revenue: {
amount: 49.99,
currency: 'USD',
},
props: {
product_id: 'prod_123',
product_name: 'Premium Widget',
},
});
<button onclick="plausible('purchase', {
revenue: { amount: 49.99, currency: 'USD' },
props: { product: 'Widget' }
})">
Buy Now
</button>
const plausible = Plausible({
domain: 'yourdomain.com',
trackLocalhost: false, // Track localhost (for dev)
apiHost: 'https://plausible.io', // Your Plausible host
hashMode: false, // Track hash changes
});
// Enable features
plausible.enableAutoPageviews();
plausible.enableAutoOutboundTracking(); // Track outbound links
Plausible offers different script variants for additional features.
<script defer data-domain="yourdomain.com"
src="https://plausible.io/js/script.outbound-links.js"></script>
<script defer data-domain="yourdomain.com"
src="https://plausible.io/js/script.file-downloads.js"></script>
<script defer data-domain="yourdomain.com"
src="https://plausible.io/js/script.hash.js"></script>
<script defer data-domain="yourdomain.com"
src="https://plausible.io/js/script.outbound-links.file-downloads.hash.js"></script>
Track custom properties with every pageview.
const plausible = Plausible({
domain: 'yourdomain.com',
});
// Set custom properties for all pageviews
plausible.enableAutoPageviews({
customProperties: () => ({
author: 'John Doe',
logged_in: 'true',
}),
});
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.pageview-props.js"></script>
<script>
window.plausible = window.plausible || function() {
(window.plausible.q = window.plausible.q || []).push(arguments);
};
// Track pageview with custom props
plausible('pageview', { props: { author: 'John Doe' } });
</script>
Plausible works automatically with pushState-based routers. For manual control:
const plausible = Plausible({
domain: 'yourdomain.com',
});
// Manual pageview tracking
plausible.trackPageview({
url: window.location.href,
referrer: document.referrer,
});
// With custom properties
plausible.trackPageview({
url: '/blog/article-1',
props: {
category: 'technology',
},
});
Proxy Plausible through your own domain to avoid ad blockers.
// next.config.js
module.exports = {
async rewrites() {
return [
{
source: '/js/script.js',
destination: 'https://plausible.io/js/script.js',
},
{
source: '/api/event',
destination: 'https://plausible.io/api/event',
},
];
},
};
<script defer data-domain="yourdomain.com"
data-api="/api/event"
src="/js/script.js"></script>
// vercel.json
{
"rewrites": [
{
"source": "/js/script.js",
"destination": "https://plausible.io/js/script.js"
},
{
"source": "/api/event",
"destination": "https://plausible.io/api/event"
}
]
}
Send events from your server without JavaScript.
// app/api/track/route.ts
import { NextRequest, NextResponse } from 'next/server';
export async function POST(request: NextRequest) {
const { name, url, props } = await request.json();
await fetch('https://plausible.io/api/event', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'User-Agent': request.headers.get('user-agent') || '',
'X-Forwarded-For': request.headers.get('x-forwarded-for') || '',
},
body: JSON.stringify({
domain: 'yourdomain.com',
name,
url,
props,
}),
});
return NextResponse.json({ success: true });
}
'use client';
import { useEffect } from 'react';
import Plausible from '@plausible-analytics/tracker';
const plausible = Plausible({
domain: 'yourdomain.com',
});
export function PlausibleProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
plausible.enableAutoPageviews();
}, []);
return <>{children}</>;
}
// Hook for tracking events
export function usePlausible() {
return {
trackEvent: (name: string, props?: Record<string, string>) => {
plausible.trackEvent(name, { props });
},
};
}
import Plausible from '@plausible-analytics/tracker';
type PlausibleEvents = {
signup: { plan: string; source: string };
purchase: { product_id: string; amount: number };
download: { file: string };
};
const plausible = Plausible({
domain: 'yourdomain.com',
});
function trackEvent<K extends keyof PlausibleEvents>(
name: K,
props: PlausibleEvents[K]
) {
plausible.trackEvent(name, { props });
}
// Type-safe event tracking
trackEvent('signup', { plan: 'pro', source: 'homepage' });
trackEvent('purchase', { product_id: 'prod_123', amount: 49.99 });
Plausible can be self-hosted using Docker.
const plausible = Plausible({
domain: 'yourdomain.com',
apiHost: 'https://analytics.yourdomain.com',
});
<script defer data-domain="yourdomain.com"
src="https://analytics.yourdomain.com/js/script.js"></script>
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.