Parse “Visit Web Page” {{trigger.tokens}} into individual query params using FlowBoost

Marketo uses offbeat definitions when it comes to web visits. For example, if you visit this URL in your browser:

https://example.com/page/4?utm_campaign=2026-01-sample-sale&utm_medium=email&utm_source=marketo#fragmento

Munchkin insists the “web page” ({{trigger.Web Page}}) is:

example.com/page/4#fragmento

That is, it’s only the host + path + hash parts of the URL. Not the protocol or the query string, which is weird.

The query string didn’t even have an associated token for a long time (it was therefore unusable in webhooks/flow steps/emails) but now we have a separate {{trigger.Query Parameters}}:

utm_campaign=2026-01-sample-sale&utm_medium=email&utm_source=marketo

Nice, but there’s still no query string parser on the Marketo back end. You can’t get individual params (utm_campaign, utm_medium, and utm_source) and write them to their own fields. Also, when filtering, you’re forced to do pretty fragile [contains] matching on the whole query string.

FlowBoost has a standard URL parser, FBHttp.URL (same as URL in browsers) which can unweird the weirdness. You just need to feed the URL constructor correctly:

  1. prepend a protocol — we assume https: these days — to the {{trigger.Web Page}} (host + path + hash)
  2. construct a URL from the protocol + host + path + hash
  3. set the URL’s search property to {{trigger.Query Parameters}}, which is automatically parsed into name-value pairs

The FlowBoost payload:

const vwpContext = {
  Protocol : "https:",
  HostPathHash: {{trigger.Web Page}},
  Search: {{trigger.Query Parameters}}
};

const url = new FBHttp.URL(vwpContext.Protocol + "//" + vwpContext.HostPathHash);
url.search =  vwpContext.Search;

hostPath = url.origin + url.pathname;
origin = url.origin;
path = url.pathname;
hostname = url.hostname;
hash = url.hash.substring(1);
fullQuery = url.searchParams.toString();

queryParams = {};
for( const [name,value] of url.searchParams ){
  queryParams[name] = value;
}

The webhook response has lots of choices ready for Response Mappings:

{
  "fullHref": "https://example.com/page/4?utm_campaign=2026-01-sample-sale&utm_medium=email&utm_source=marketo#fragmento",
  "hostPath": "https://example.com/page/4",
  "origin": "https://example.com",
  "path": "/page/4",
  "hostname": "example.com",
  "hash": "fragmento",
  "fullQuery": "utm_campaign=2026-01-sample-sale&utm_medium=email&utm_source=marketo",
  "queryParams": {
    "utm_campaign": "2026-01-sample-sale",
    "utm_medium": "email",
    "utm_source": "marketo"
  }
}

For example, map queryParams.utm_campaign to a custom field Last utm_campaign.