Script attributes

Simple configuration using data-* attributes on the script tag.
developer

Overview

Script attributes provide the simplest way to configure the SDK using data-* attributes on the script tag.

Basic setup

<script src="https://sdk.ocmcore.com/sdk/ht-latest.js" data-tag="NjY4bL60M84D7DQ235QxNDY4MjE0NhGg" async></script>

Supported attributes

AttributeTypeRequiredDefaultDescription
data-tagstring✅ Yes-Your configuration key used by auto-conf to fetch settings from Configuration Hub
data-analytics“1” or “0”No“0”Enable/disable analytics tracking (page views, clicks) before auto-conf loads
data-amp“1”No“0”Enable AMP mode for push notification flows
data-modal_urlURLNohttps://cdn.ocmtag.com/c/Remote URL where modal templates are hosted (e.g., https://cdn.example.com/modals/)
data-tag_urlURLNohttps://cdn.ocmtag.com/c/Remote URL where auto-conf JSON configuration is hosted (e.g., https://cdn.example.com/config/)
data-disable-autoconf“1”No“0”Disable auto-conf fetching - use only local configuration
data-no-override“1”No“0”Prevent remote auto-conf from overriding local settings (when “1”, local settings take priority over remote config)
data-crashlytics“1” or “0”No“0”Enable/disable JavaScript error reporting
data-consent“1” or “0”No“0”Set to “1” only after user has given consent for advanced tracking - enables persistent user ID for better analytics and user recognition (without consent, only anonymous session tracking)
data-functionstringNo“Hood”Custom name for the global function used to call SDK methods like Hood('init'), Hood('trackevent')

Protected attributes (cannot be overridden)

These attributes are ignored for security reasons and must be configured via auto-conf:

AttributeDescription
data-analytics_urlURL where tracking data is sent
data-crashlytics_urlURL where JavaScript errors are reported
data-activity_urlURL where user activities are logged
data-subscription_urlURL where profile subscriptions are managed

Examples

Basic tracking

<script src="https://sdk.ocmcore.com/sdk/ht-latest.js" data-tag="NjY4bL60M84D7DQ235QxNDY4MjE0NhGg" async></script>

With analytics enabled

<script 
  src="https://sdk.ocmcore.com/sdk/ht-latest.js" 
  data-tag="NjY4bL60M84D7DQ235QxNDY4MjE0NhGg" 
  data-analytics="1"
  async>
</script>

Custom URLs

<script 
  src="https://sdk.ocmcore.com/sdk/ht-latest.js" 
  data-tag="NjY4bL60M84D7DQ235QxNDY4MjE0NhGg" 
  data-modal_url="https://cdn.example.com/modals/"
  data-tag_url="https://cdn.example.com/tags/"
  async>
</script>

When to use

✅ Good for❌ Not suitable for
Simple setupsComplex modal configurations
Basic trackingA/B testing setups
Quick integrationAdvanced targeting rules
Standard configurationsCustom push configurations

Limitations

  • Only supports simple key/value pairs
  • No complex object configurations
  • Limited to basic features
  • Cannot override protected URL keys