Configuration methods
The Hood Web SDK supports multiple ways to configure features and behavior. Choose the approach that best fits your needs:
Script attributes (Simple)
Quick setup with data-* attributes on the script tag. Perfect for basic configurations.
Manual initialization (Advanced)
Full control with Hood('init', tag, config) for complex setups like A/B testing, custom modals, and advanced targeting.
Hybrid approach (Flexible)
Combine script attributes with manual overrides for maximum flexibility.
Examples (Real-world)
Comprehensive examples for different use cases, environments, and scenarios.
Auto-conf
Auto-conf automatically fetches your configuration from Configuration Hub using your data-tag. This allows you to:
- Manage everything in one place — configure modals, push, targeting rules in your Hood dashboard
- Update without code changes — modify configurations without touching your website
- Use any configuration method — auto-conf works with script attributes, manual init, or hybrid approaches
Disabling auto-conf
Configuration option: data-disable-autoconf="1"
When set to "1", the SDK will skip fetching remote configuration from Configuration Hub and use only local settings.
<script src="https://sdk.ocmcore.com/sdk/ht-latest.js" data-tag="TAG_ID" data-disable-autoconf="1"></script>
Auto-conf precedence control
data-autoconf-priority="local" or data-autoconf-priority="remote"
remote (default): Remote config from Configuration Hub overrides local settings
local: Local settings override remote config<script src="https://sdk.ocmcore.com/sdk/ht-latest.js" data-tag="TAG_ID" data-autoconf-priority="local"></script>
Why multiple options?
We offer different configuration methods because every team and project has different needs:
- Marketing teams prefer Configuration Hub for easy updates
- Developers want code-based control for complex features
- DevOps teams need script attributes for deployment automation
- Agencies use hybrid approaches for client flexibility
Choose what works best for your workflow.
Configuration precedence
Configuration is applied in this order (highest to lowest priority):
Hood('config', key, value)
Manual init config Hood('init', tag, { ... })
Script attributes data-*
Remote auto-conf from Configuration Hub
SDK defaultsProtected keys
Some base URL keys cannot be overridden via script attributes for security, but can be configured via auto-conf:
analytics_url(URL where tracking data is sent)crashlytics_url(URL where JavaScript errors are reported)activity_url(URL where user activities are logged)subscription_url(URL where profile subscriptions are managed)
These must be managed via remote config (Configuration Hub) or SDK defaults.
Quick reference
| Method | Use case | Complexity | Control |
|---|---|---|---|
| Script attributes | Basic setup | Low | Limited |
| Manual init | Complex features | High | Full |
| Hybrid | Flexible setup | Medium | High |