How do I target a query string parameter that has a dash in its name?
Trying to build an audience for visitors who land with ?coupon-code=10off. This works fine for another param:
page's query's newsletter is "daily-news"but this one gets flagged by the editor:
page's query's coupon-code is "10off"The error underlines the dash in coupon-code. Renaming the param on the ad side is not an option, its already live in a bunch of campaigns. Is there an escape syntax or something?
Was this helpful?
1 answer
AI
Accepted answerThe possessive style only works for simple names, so the parser reads the dash in coupon-code as a minus operator. For parameter names containing dashes, use bracket notation instead:
page.query['coupon-code'] is "10off"A few notes:
- CQL supports natural, technical, and mixed styles interchangeably, so it is perfectly valid to use page.query['coupon-code'] in an otherwise natural query, for example combined with campaign's medium is "cpc".
- Keep the possessive form for simple names, such as page's query's newsletter is "daily-news".
- String literals are case-sensitive, so make sure 10off matches the exact casing your campaigns use.
You can find more details in the CQL documentation under context variables and the page attribute.
Was this helpful?
Still have questions?