Script attributes
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
data-tag
- Type:
string - Required: Yes
- Description: Your configuration key used by auto-conf to fetch settings from Configuration Hub
data-analytics
- Type:
"1" - Default: unset (load trigger only)
- Description: Set
data-analytics="1"to add thepageViewandclickanalytics triggers. Omit the attribute to keep theloadtrigger only. Load and unload beacons still send. See the Web SDK Reference.
data-amp
- Type:
"1" - Default:
"0" - Description: Enable AMP mode for push notification flows
data-disable-autoconf
- Type:
"1" - Default:
"0" - Description: Disable auto-conf fetching - use only local configuration
data-no-override
- Type:
"1" - Default: unset (off)
- Description: Set
data-no-override="1"so existing local values keep priority over auto-conf. Built-in defaults count as local values, including the*_urlkeys andfunction— seeconfig().
data-crashlytics
- Type:
"1"or"0" - Default:
"0" - Description: Enable/disable JavaScript error reporting
data-consent
- Type:
"1" - Default: unset
- Description: Marks the integration as consent-aware on the analytics beacon (
eC). Set consent with aconsentkey oninit/ auto-conf, or callHood('consent', true)/Hood('consent', false).
data-function
- Type:
string - Default:
"Hood" - Description: Custom name for the global function used to call SDK methods like
Hood('init'),Hood('trackevent')
Set *_url endpoints with auto-conf, Hood('init', tag, config), or Hood('config', key, value) before init.
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 function name
<script
src="https://sdk.ocmcore.com/sdk/ht-latest.js"
data-tag="NjY4bL60M84D7DQ235QxNDY4MjE0NhGg"
data-function="Engage"
async>
</script>
When to use
Good for:
- Simple setups
- Basic tracking
- Quick integration
- Standard configurations
Not suitable for:
- Complex modal configurations
- A/B testing setups
- Advanced targeting rules
- Custom push configurations
Limitations
- Only supports simple key/value pairs
- No complex object configurations
- Limited to basic features