Runtime verified Test scripts included

Composes a link from a base URL plus UTM and custom query parameters and wraps it for click tracking. Errors when the base URL is empty.

Syntax

{{buildUrl base [...options]}}

Returns string.

Parameters

Name Type Required Description
base string Yes Destination URL; query parameters it already has are kept.
options any No, repeatable Named arguments: encode, label or sfmclinkalias (not both), noTracking, sfmclinkid, utm_campaign, utm_content, utm_medium, utm_source, utm_term, plus any custom key=”value” query parameters.

Example

Tested in a Marketing Cloud Next email on 2026-11-22:

  • {{buildUrl "https://example.com/a" noTracking=true utm_campaign="spring"}} renders https://example.com/a?utm_campaign=spring, as documented.
  • {{buildUrl "https://example.com/a"}} renders https://example.com/a.
Show Next test script
<!-- Marketing Cloud Next test script for the buildUrl helper. Paste it into the HTML component of a
     Next email and open the preview. Each line prints the result Next gave when the call
     was rendered on its own (expect) next to the result of this run (got).
     Assembled from single-call test emails (dates on the page); it has not been
     run as one email. Calls that make Next fail are listed separately. -->
<p>c1 expect=[https://example.com/a?utm_campaign=spring] got=[{{buildUrl "https://example.com/a" noTracking=true utm_campaign="spring"}}]</p>
<p>c2 expect=[https://example.com/a] got=[{{buildUrl "https://example.com/a"}}]</p>

Marketing Cloud Next

Works as documented

Every tested call rendered the documented result. Tested 2026-11-22 by rendering in a Marketing Cloud Next email.

See also