Rule Engine & Templates

Learn how rules are evaluated and configure Marriott SCID or custom templates

The Cogwheel Attribute Rule Engine evaluates visitor sessions and dynamically rewrites links, inputs, and DOM attributes.

How the Rule Engine Works

When a visitor lands on your vanity website, the Cogwheel script captures their attribution parameters (UTMs, referrer, click IDs) and stores them in first-party cookies/localStorage.

Every time the visitor hovers over or clicks a link, or when a form is submitted, the script evaluates your project's rules:

  1. Rules are evaluated in priority order from top to bottom (ascending order of rule_order).
  2. The first rule that meets all trigger conditions "wins."
  3. The actions associated with that rule are executed (e.g., appending a query param to the outbound link).
  4. If a conflict arises between two matching rules, the higher-priority rule (positioned higher on the list) takes precedence.

Attribution Rules Configuration Matrix


Brand Rule Templates

For convenience, Cogwheel Attribute includes pre-configured brand templates (supporting Marriott, Hilton, Hyatt, etc.). You only need to input your specific campaign or source IDs.

1. Google Ads Template

  • Trigger Conditions:
    • URL contains gclid, gad_source, gbraid, or wbraid
    • OR utm_source equals google AND utm_medium equals cpc
  • Default Actions:
    • Appends the brand's tracking parameter with your campaign identifier:
      • Marriott: Appends cid with your Google Ads PMO_ SCID.
      • Hilton: Appends WT.mc_id with your Google Ads campaign ID.
      • Hyatt: Appends src with your Google Ads source code.
    • Target outbound links matching the respective brand domain (e.g., marriott.com, hilton.com, hyatt.com).
  • Recommendation: Place this rule near the top of your stack.

2. Meta Ads (Facebook & Instagram) Template

  • Trigger Conditions:
    • URL contains fbclid or cft
    • OR utm_source equals facebook (or instagram / ig) AND utm_medium equals paid_social (or cpc / ads)
  • Default Actions:
    • Appends the brand's tracking parameter with your campaign identifier (e.g., Marriott cid / PMO_ SCID, Hilton WT.mc_id, or Hyatt src).
    • Target outbound links matching the respective brand domain.

3. Microsoft/Bing Ads Template

  • Trigger Conditions:
    • URL contains msclkid
    • OR utm_source equals bing AND utm_medium equals cpc
  • Default Actions:
    • Appends the brand's tracking parameter with your campaign identifier.
    • Target outbound links matching the respective brand domain.

4. Unpaid Referrer / Fallback Template

  • Trigger Conditions:
    • Catch-all (fires if no paid parameters are found in the visitor's session).
  • Default Actions:
    • Appends the brand's tracking parameter with your unpaid campaign identifier (e.g., Marriott UNP_ SCID).
    • Target outbound links matching the respective brand domain.
  • IMPORTANT: This catch-all rule must reside at the very bottom of the priority list. If it is placed at the top, it will match all traffic and bypass your paid templates.

Custom Rules (UTM & Query String)

If you use custom UTM setups or non-Marriott booking engines, you can build rules from scratch:

  1. Click New Rule -> Create from Scratch.
  2. Define Conditions: Combine rows using AND/OR logic:
    • Parameter Matching: Match query variables (e.g., utm_campaign, source).
    • Page Context: Match current page path or hostname.
    • Referrer: Match specific domains (e.g., tripadvisor.com).
  3. Define Actions:
    • Append URL Parameter: Appends custom key-value pairs (e.g., utm_source=vanity).
    • Inject Hidden Input: Adds inputs to matching form submissions.
    • Set DOM Attribute: Sets custom HTML attributes (e.g., data-attribution="social").
  4. Specify Targets: Restrict rules to certain outbound links using URL contains or CSS selectors.

Reference: Condition Fields & Brand Mappings

Traffic Source Condition Fields

When building custom conditions, Cogwheel Attribute provides preset boolean fields representing detected traffic sources:

Condition FieldMatches Session When...
google_ads_sessionLanding URL contains gclid, gad_source, gbraid, wbraid, or utm_source=google + utm_medium=cpc.
meta_ads_sessionLanding URL contains fbclid, cft, or utm_source=facebook/instagram + utm_medium=paid_social/cpc.
bing_ads_sessionLanding URL contains msclkid or utm_source=bing + utm_medium=cpc.
tiktok_ads_sessionLanding URL contains ttclid or utm_source=tiktok.
linkedin_ads_sessionLanding URL contains li_fat_id or utm_source=linkedin.
twitter_ads_sessionLanding URL contains twclid or utm_source=twitter/x.
reddit_ads_sessionLanding URL contains rdt or utm_source=reddit.
fallback_sessionCatch-all for any session that does not match any paid search/social presets.

Hotel Brand Parameters

The application features native presets to map rules to specific booking domains. Outbound links targeting these domains automatically receive the associated parameter name:

  • Marriott: Targets marriott.com using parameter cid (typically carrying an SCID).
  • Hilton: Targets hilton.com using parameter WT.mc_id.
  • Hyatt: Targets hyatt.com using parameter src (typically carrying a concatenated Hyatt source code).
  • IHG: Targets ihg.com using parameter cm_mmc.
  • Wyndham: Targets wyndhamhotels.com using parameter CID.
  • Choice: Targets choicehotels.com using parameter mc.

On this page