Skip to main content

Rules

Rules enable smart routing - directing visitors to different destinations based on conditions.

How Rules Work

  1. Visitor clicks your short link
  2. Linquid evaluates rules in priority order (highest first)
  3. First matching rule determines the destination
  4. If no rules match, the default destination is used

Rule Structure

{
  "id": "rule_abc123",
  "name": "Mobile Users to App",
  "type": "device",
  "conditions": {
    "devices": ["mobile"]
  },
  "destinationUrl": "https://apps.apple.com/app/yourapp",
  "priority": 80,
  "enabled": true
}

Rule Types

Geographic Routing (geo)

Route by location:
{
  "type": "geo",
  "conditions": {
    "countries": ["US", "CA"],
    "operator": "in"  // or "not_in"
  }
}

Device Routing (device)

Route by device type:
{
  "type": "device",
  "conditions": {
    "devices": ["mobile", "tablet"],
    "os": ["ios", "android"]
  }
}

Time-Based Routing (time)

Route by time of day or day of week:
{
  "type": "time",
  "conditions": {
    "timezone": "America/New_York",
    "days": ["monday", "tuesday", "wednesday", "thursday", "friday"],
    "startTime": "09:00",
    "endTime": "17:00"
  }
}

Referrer Routing (referrer)

Route by traffic source:
{
  "type": "referrer",
  "conditions": {
    "referrers": ["facebook.com", "instagram.com"],
    "operator": "contains"
  }
}

UTM Routing (utm)

Route by UTM parameters:
{
  "type": "utm",
  "conditions": {
    "utm_source": "newsletter",
    "utm_campaign": "spring_sale"
  }
}

Percentage/A/B Testing (percentage)

Split traffic:
{
  "type": "percentage",
  "conditions": {
    "percentage": 50
  }
}

Language Routing (language)

Route by browser language:
{
  "type": "language",
  "conditions": {
    "languages": ["es", "pt"],
    "operator": "in"
  }
}

Visitor State (visitor_state)

Route new vs returning visitors:
{
  "type": "visitor_state",
  "conditions": {
    "state": "new"  // or "returning"
  }
}

Priority

Rules are evaluated by priority (1-100, higher = evaluated first):
  • 90-100: Critical overrides
  • 70-89: Primary routing
  • 50-69: Secondary routing
  • 30-49: Fallback rules
  • 1-29: Low priority / catch-all

Deep Linking in Rules

Each rule can have its own deep link configuration:
{
  "type": "device",
  "conditions": { "os": ["ios"] },
  "destinationUrl": "https://apps.apple.com/app/id123",
  "deepLinkEnabled": true,
  "deepLinkIos": "yourapp://product/123",
  "deepLinkFallbackUrl": "https://example.com/product/123"
}

Reusable Rules

Rules can be attached to multiple links via the Link-Rules relationship, allowing you to manage routing logic centrally.