Skip to main content

Overview

The ctx.utils object provides utility functions for common data transformations and normalizations. These helpers make it easier to work with URLs, strings, and other data types in your formulas.

Available Utilities

ensureHttp()

Ensure a URL has a protocol (http or https). If the URL already has a protocol, it is returned unchanged. Otherwise, https:// is prepended.
Parameters:
  • url - The URL to normalize
Returns: The URL with a protocol Example:
Common Use Case:

normalizeUrl()

Normalize a URL by removing the protocol, www., paths, and query parameters. This is useful for deduplication and comparison.
Parameters:
  • url - The URL to normalize
Returns: The normalized URL (domain only, no protocol or www) Example:
Common Use Case:

Best Practices

URL Normalization Tips:
  1. Always normalize for deduplication: Use normalizeUrl() to create a consistent domain format for matching records
  2. Ensure protocol before API calls: Use ensureHttp() before passing URLs to services that require full URLs
  3. Handle edge cases: Check for null/empty values before normalizing