Implements session replay and error tracking with LogRocket for debugging user issues. Use when adding session recording, error monitoring, and performance tracking to React applications.
Adds session replay and error tracking with LogRocket for debugging React applications. Use when you need to record user sessions, monitor errors, or track performance issues in React apps.
/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.
Session replay platform with error tracking, performance monitoring, and product analytics. Captures every user interaction for debugging.
npm install logrocket logrocket-react
// logrocketSetup.ts
import LogRocket from 'logrocket';
LogRocket.init('your-app-id/your-project');
// main.tsx - Import setup FIRST
import './logrocketSetup';
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<App />
</React.StrictMode>
);
import LogRocket from 'logrocket';
// Identify user after login
function onLogin(user) {
LogRocket.identify(user.id, {
name: user.name,
email: user.email,
// Custom attributes
subscriptionType: user.plan,
createdAt: user.createdAt,
});
}
// Anonymous session (before login)
LogRocket.identify('anonymous-user-123');
import LogRocket from 'logrocket';
// Basic event
LogRocket.track('Button Clicked');
// Event with properties
LogRocket.track('PurchaseComplete', {
revenue: 42.99,
productCategory: 'Clothing',
productSku: 4887369299,
couponApplied: true,
customerSegments: ['aef34b', '97cb20'],
});
// Form submission
LogRocket.track('FormSubmitted', {
formName: 'contact',
success: true,
});
// Feature usage
LogRocket.track('FeatureUsed', {
featureName: 'export',
format: 'csv',
});
import LogRocket from 'logrocket';
import setupLogRocketReact from 'logrocket-react';
// After LogRocket.init()
setupLogRocketReact(LogRocket);
This automatically captures:
import LogRocket from 'logrocket';
try {
// risky operation
} catch (error) {
LogRocket.captureException(error);
}
// With extra context
LogRocket.captureException(error, {
tags: {
component: 'PaymentForm',
userId: 'user_123',
},
extra: {
orderId: 'order_456',
attemptNumber: 3,
},
});
LogRocket captures console logs automatically. Add custom context:
import LogRocket from 'logrocket';
// Log with structured data
LogRocket.log('Processing order', { orderId: 'order_123', items: 3 });
LogRocket.info('User action', { action: 'checkout_started' });
LogRocket.warn('Rate limit approaching', { remaining: 10 });
LogRocket.error('Payment failed', { reason: 'insufficient_funds' });
import LogRocket from 'logrocket';
import { createStore, applyMiddleware } from 'redux';
const store = createStore(
rootReducer,
applyMiddleware(LogRocket.reduxMiddleware())
);
import { configureStore } from '@reduxjs/toolkit';
import LogRocket from 'logrocket';
const store = configureStore({
reducer: rootReducer,
middleware: (getDefaultMiddleware) =>
getDefaultMiddleware().concat(LogRocket.reduxMiddleware()),
});
LogRocket captures network requests automatically. Sanitize sensitive data:
LogRocket.init('app-id/project', {
network: {
requestSanitizer: (request) => {
// Remove authorization header
if (request.headers['Authorization']) {
request.headers['Authorization'] = '[REDACTED]';
}
// Sanitize request body
if (request.body) {
const body = JSON.parse(request.body);
if (body.password) {
body.password = '[REDACTED]';
}
request.body = JSON.stringify(body);
}
return request;
},
responseSanitizer: (response) => {
// Sanitize response body
if (response.body) {
const body = JSON.parse(response.body);
if (body.token) {
body.token = '[REDACTED]';
}
response.body = JSON.stringify(body);
}
return response;
},
},
});
LogRocket.init('app-id/project', {
dom: {
// Mask all inputs
inputSanitizer: true,
// Mask specific elements
textSanitizer: true,
// Mask by CSS selector
privateAttributeBlocklist: ['data-private'],
},
});
<!-- Mask specific elements -->
<input type="password" data-private />
<div data-private>Sensitive content</div>
<!-- Or use CSS class -->
<div class="lr-hide">Hidden from replay</div>
<!-- Completely hide from DOM -->
<div data-logrocket-hidden>
This content won't appear in recordings
</div>
Only record certain users or conditions:
import LogRocket from 'logrocket';
// Check condition before initializing
if (shouldRecordUser(user)) {
LogRocket.init('app-id/project');
LogRocket.identify(user.id, { name: user.name });
}
// Or start/stop recording
LogRocket.startRecording();
LogRocket.stopRecording();
LogRocket.init('app-id/project', {
shouldSendData: () => {
// Record 10% of sessions
return Math.random() < 0.1;
},
});
Get the session URL for support tickets:
import LogRocket from 'logrocket';
LogRocket.getSessionURL((sessionURL) => {
// Send to support system
console.log('Session URL:', sessionURL);
// Or add to error reports
Sentry.setExtra('sessionURL', sessionURL);
});
import * as Sentry from '@sentry/react';
import LogRocket from 'logrocket';
LogRocket.getSessionURL((sessionURL) => {
Sentry.configureScope((scope) => {
scope.setExtra('sessionURL', sessionURL);
});
});
import LogRocket from 'logrocket';
LogRocket.getSessionURL((sessionURL) => {
// Add to your error tracking
errorTracker.setContext('logrocket_session', sessionURL);
// Or send to your backend
fetch('/api/session', {
method: 'POST',
body: JSON.stringify({ sessionURL, userId: currentUser.id }),
});
});
// app/providers.tsx
'use client';
import { useEffect } from 'react';
import LogRocket from 'logrocket';
import setupLogRocketReact from 'logrocket-react';
export function LogRocketProvider({ children }: { children: React.ReactNode }) {
useEffect(() => {
if (typeof window !== 'undefined') {
LogRocket.init('app-id/project');
setupLogRocketReact(LogRocket);
}
}, []);
return <>{children}</>;
}
// app/layout.tsx
import { LogRocketProvider } from './providers';
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
<LogRocketProvider>
{children}
</LogRocketProvider>
</body>
</html>
);
}
LogRocket.init('app-id/project', {
// Console options
console: {
isEnabled: true,
shouldAggregateConsoleErrors: true,
},
// Network options
network: {
isEnabled: true,
requestSanitizer: (request) => request,
responseSanitizer: (response) => response,
},
// DOM options
dom: {
isEnabled: true,
inputSanitizer: true,
textSanitizer: false,
baseHref: 'https://yourdomain.com',
},
// Release tracking
release: process.env.NEXT_PUBLIC_VERSION,
// Parent domain (for cross-subdomain tracking)
parentDomain: 'yourdomain.com',
// Merge IDs (connect anonymous with identified)
mergeImmediately: true,
});
import LogRocket from 'logrocket';
interface UserTraits {
name: string;
email: string;
plan: 'free' | 'pro' | 'enterprise';
createdAt: string;
}
function identifyUser(userId: string, traits: UserTraits) {
LogRocket.identify(userId, traits);
}
interface PurchaseEvent {
productId: string;
amount: number;
currency: string;
}
function trackPurchase(event: PurchaseEvent) {
LogRocket.track('Purchase', event);
}
LogRocket automatically captures:
Access in the LogRocket dashboard under Performance.
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.