React Quickstart
This guide shows you how to integrate walkerOS into your React application with automatic pageview tracking and component-level event tracking.
Key Concepts
- Single file setup: One initialization file, direct usage in App.tsx
- No providers needed: Direct integration in your main App component
- StrictMode safe: Handles React's double execution correctly
- Data attributes: Use the tagger helper for clean component tracking
Installation
First, install the required walkerOS packages:
Loading...
Setup
1. walker initialization
Loading...
2. App integration
Integrate directly in your main App component:
Loading...
Component tagging
Use the tagger helper for clean component tracking:
Loading...
Loading...
info
When using the tagger helper, make sure to call .get() at the end of the
chain.
Manual event tracking
Use the elb function for custom events:
Loading...
Testing
During #1-walker-initialization, we added a console destination. This will output events to the console. Open your browser's developer console to see tracked events:
Event: "product view", { id: 123, name: "Premium Chocolate", price: 12.99 }
Best Practices
- Use tagger: Clean component tagging with the tagger helper
- Minimal React code: Keep React integration as simple as possible
- Trust walkerOS: No need for custom error handling or state management
- Direct integration: No providers needed, integrate directly in App component
- Test with console: Use console destination during development
Troubleshooting
Events not firing
- Check that
window.walkeris set in the browser console - Verify data attributes are correctly formatted (use
data-elbprefix) - Ensure walker initialization completed (window.walker.allowed must be
true) - Check browser console for any error messages
Route changes not tracked
- Check that
walker runis called on route changes inwindow.elbLayer - Ensure firstRun logic is preventing double execution on initial load
- Verify location/pathname dependency is working correctly
Next Steps
- Configure destinations for your analytics tools
- Set up consent management
💡 Need Professional Support?
Need professional support with your walkerOS implementation? Check out our services.