Next.js Quickstart
This guide shows you how to integrate walkerOS into your Next.js application. Most setup is identical to React - check the React quickstart guide for more details.
Installation
Install the required packages:
Loading...
Setup
1. Walker initialization
Create the walker initialization file:
Loading...
2. App integration
For Next.js applications, use the Next.js router events:
Loading...
For Next.js 13+ with App Router:
Loading...
Component usage
Component usage is identical to React. Use the tagger helper and manual events:
Loading...
info
When using the tagger helper, make sure to call .get() at the end of the
chain.
Testing
During 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 Next.js code: Keep Next.js 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 or layout
- 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 - Ensure firstRun logic is preventing double execution on initial load
- Verify router event listeners are working correctly
TypeScript Errors
Make sure you've added the global type declarations in your walker initialization file.
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.