App Data
Overview
App Data is a flexible metadata system enabling developers to attach additional information to CoW Protocol orders. It supports developer attribution, analytics tracking, custom hooks, and more.What is App Data?
App Data is a 32-byte hash (bytes32) stored in every order that points to a JSON document containing metadata. The document can include slippage tolerance, order classification, UTM tracking, partner fees, CoW Hooks, and custom application data.
App Data Structure
Creating App Data
Basic Usage
Using in Orders
Default UTM Parameters
The SDK automatically includes UTM parameters:Overriding UTM Parameters
Partner Fees
CoW Hooks
CoW Hooks execute custom contract calls before and/or after order execution, enabling token approvals, reward claiming, staking, and arbitrary DeFi operations.Hook Structure
Pre-Hooks Example
Post-Hooks Example
Advanced Usage
Merging App Data
Custom Metadata Fields
IPFS Integration
Retrieving App Data
Common Patterns
Market Order:Best Practices
- Use Descriptive App Codes: Choose clear, unique identifiers for analytics
- Set Appropriate Slippage: Market orders 0.5-1%, limit orders 0%, volatile tokens higher
- Test Hooks Thoroughly: Always test on testnets before production
- Cache App Data Hashes: Reuse identical metadata hashes to reduce IPFS uploads
Troubleshooting
App data hash mismatch: Ensure the exactfullAppData JSON string with deterministic formatting is used. The SDK handles this automatically.
Hook execution failed: Verify target contract address, callData encoding matches function signature, gasLimit is sufficient, and test hook separately.
Custom UTM not appearing: When providing metadata.utm, it replaces all defaults. Set all desired UTM fields explicitly.
Next Steps
- Order Types - Learn about different order types
- Trading SDK - Start building with the SDK
- Hooks Guide - Advanced hooks implementation