0

How to customize segment using query string or cookie in Adobe CQ5.6?

My requirement as follows:

I wanted to target querystring parameters in Segment which is added in my Experience, Teaser, Promotion, Voucher for owned site.

Thanks in advance.

MayureshP
  • 2,514
  • 6
  • 31
  • 41

1 Answers1

1

You can define your own segment at outlined here: https://docs.adobe.com/docs/en/cq/5-6-1/administering/segmentation.html#Defining%20a%20New%20Segment

In step 6 where you edit the segment, you need to supply a JavaScript expression that will resolve to a boolean, true or false. You can put any JavaScript expression here that meets your need, so you can include script that will have a complex expression if you want. But rather than write a complex JavaScript expression here, it would be better to write JavaScript that exposes a function which returns true or false and then include that JavaScript function on your pages via a client library. Then, in the segment, you can simply invoke the function rather defined in your client library than try to write a complex expression.

As long as the JavaScript expression defined in the segment evaluates to true/false, the segment will be usable.

Without your own JavaScript you can easily fetch query string values of look at cookies. See these other questions for details on that:

Community
  • 1
  • 1
Shawn
  • 8,374
  • 5
  • 37
  • 60