All questions

How do I match a specific URL query parameter value in an audience?

Asked by kev_marketing on

Kkev_marketing

our newsletter links all carry a query parameter, something like ?newsletter=daily-news, and I want a tailored hero only for people who arrive with that exact value.

How does CQL read a query parameter and match on its value? I run these campaigns myself so a copy-paste example would be great.

Was this helpful?

2 answers

TBTom Becker

page exposes the query, so you reach into it by parameter name:

page's query's newsletter is "daily-news"

That only matches visitors arriving with that exact value. One thing to watch, string literals are case-sensitive, so "Daily-News" would miss, match the casing your links actually use.

Was this helpful?
Nnina_k

Works great until you have a parameter name with a dash in it, then the query's name form does not parse. For those use bracket notation:

page.query['coupon-code'] is "10off"

Same idea, just the syntax that survives the dash. There is a whole dashed query parameter thread on it if you hit that. If the traffic is UTM-tagged you might also read it off the campaign instead, like the UTM campaign audience.

Was this helpful?
Kkev_marketing

the plain form did it for this one, but good to know about the brackets since half our coupon params have dashes. thanks!

Still have questions?