All questions

Showing a banner only when visitors land with our coupon link

Asked by Trish Delaney on

TDTrish Delaney

ok so our email links look like oursite.com/?coupon-code=10off and I want a banner that only shows for people arriving through those links. I went into the audience editor and tried writing the condition like this:

page's query's coupon-code is "10off"

and it just keeps erroring. I tried a few variations with quotes around coupon-code too and no luck. what am I doing wrong here? I'm not a developer, I just click around the dashboard until things work usually

Was this helpful?

1 answer

Bben_a83

You are very close. The dash in coupon-code is the problem: the possessive style (page's query's something) only works for plain parameter names. A name with a dash needs bracket notation instead:

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

That is the documented form for exactly this case. For comparison, a parameter without dashes works fine the way you were writing it, e.g.:

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

So it is only the dashed name that forces the switch, and you can mix both styles in one condition if you ever need to.

Once you save the audience, it evaluates in real time when someone lands with that link, so the banner shows on the very first page. No code changes to the store needed, this is all dashboard work.

Was this helpful?
TDTrish Delaney

the bracket thing worked!! tested it with the link from our last email and the banner showed right away. thank you so much

Still have questions?