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.

Script attributes →

Manual initialization (Advanced)

Full control with Hood('init', tag, config) for complex setups like A/B testing, custom modals, and advanced targeting.

Manual initialization →

Hybrid approach (Flexible)

Combine script attributes with manual overrides for maximum flexibility.

Hybrid approach →

Domain filtering (Allowlist)

Restrict where the SDK runs with the domains allowlist: exact hostnames, wildcard subdomains, origins, and regex patterns.

Domain filtering →

Examples (Real-world)

Comprehensive examples for different use cases, environments, and scenarios.

Examples and best practices →

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

Disable 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

Control precedence
Configuration option: 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):

Configuration priority
Runtime overrides Hood('config', key, value) Manual init config Hood('init', tag, { ... }) Script attributes data-* Remote auto-conf from Configuration Hub SDK defaults

Protected 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.

The domains allowlist behaves similarly: it can only be set via auto-conf or Hood('init'), and a remote value always wins — even under no-override.

Quick reference

MethodUse caseComplexityControl
Script attributesBasic setupLowLimited
Manual initComplex featuresHighFull
HybridFlexible setupMediumHigh