Hybrid approach

Combine script attributes with manual initialization for maximum flexibility.
developer

Overview

The hybrid approach combines the best of both worlds: auto-conf for base configuration and runtime overrides for dynamic control. This gives you the flexibility to manage core settings in Configuration Hub while allowing developers to override specific values programmatically.

Benefits:

  • Marketing teams can manage base configuration in Configuration Hub
  • Developers can override settings based on user behavior, A/B tests, or environment
  • No code deployments needed for base configuration changes
  • Full control when you need it

Basic hybrid setup

<script>
  window.HoodEngage = window.HoodEngage || [];
  function Hood() { HoodEngage.push(arguments); }
  
  // Override auto-conf settings at runtime
  Hood('config', 'analytics', true);
  Hood('config', 'modal_url', 'https://cdn.example.com/modals/');
</script>

<script 
  src="https://sdk.ocmcore.com/sdk/ht-latest.js" 
  data-tag="NjY4bL60M84D7DQ235QxNDY4MjE0NhGg"
  data-analytics="0"    // Will be overridden by Hood('config')
  async>
</script>

More examples

For comprehensive hybrid examples including A/B testing, environment-specific overrides, and advanced configurations, see Hybrid approach examples.

Configuration details

Controlling configuration priority

Configuration option: data-no-override="1" or data-no-override="0"

"1" (local priority): Local settings override remote auto-conf "0" or omitted (remote priority): Remote auto-conf overrides local settings

Configuration precedence:

  1. Runtime overrides Hood('config', key, value) (highest priority)
  2. Script attributes data-* or Remote auto-conf (depends on data-no-override)
  3. SDK defaults (lowest priority)

When to use hybrid

Good for:

  • Complex features with simple base config
  • A/B testing with custom templates
  • Dynamic configurations
  • Gradual migration from simple to complex
  • Team workflows (devs use script attrs, advanced users override)

Consider alternatives when:

  • Simple setup is sufficient
  • Full manual control needed
  • Avoiding complexity
  • Single developer projects
  • Limited configuration needs

Best practices

Best practices

Use script attributes for basics: data-tag, data-analytics, URLs

Use manual init for complex features: modals, A/B tests, advanced targeting

Be explicit about precedence: Document which settings override others

Test thoroughly: Hybrid can be complex, test all combinations

Consider team workflow: Who configures what and when