Using Bily Hooks
TheuseBily hook provides access to the Bily tracking client within your React components.
Basic Usage
Hook API
TheuseBily hook returns a tracking client with the following methods:
Common Use Cases
Page View Tracking
Form Submission Tracking
E-commerce Tracking
Error Handling
The hook will throw an error if used outside of aBilyProvider:
useBily are wrapped with a BilyProvider.
Best Practices
- Use the hook at the component level that needs tracking
- Avoid unnecessary re-renders by memoizing callbacks
- Include relevant context in event payloads
- Handle errors appropriately
Next Steps
- See Component Examples
- Learn about E-commerce Integration
- Explore Advanced Configuration