It’s the mid­dle of the night…you wake up in a cold sweat…you think back to that great Dis­cover analy­sis that you pre­sented to the entire com­pany which cowork­ers praised, change the approach of major global ini­tia­tives, and appeared to be the answer to world peace. And then the ques­tions start to hit you…did I seg­ment cor­rectly when gen­er­at­ing that data? Was that an AND or an OR state­ment that I used in my seg­ment? Did I cor­rectly make all of the dif­fer­ent state­ments work together?

Well, you’re not alone. Detailed seg­men­ta­tion is a crit­i­cal part of Dis­cover func­tion­al­ity and to seg­ment cor­rectly you need to know how to work with cri­te­ria and to prop­erly struc­ture each con­di­tion to cor­rectly iden­tify the seg­ment that you want. Here are a few details on work­ing with AND/OR state­ments using the Dis­cover seg­ment builder. Launch Dis­cover and open the seg­ment builder by click­ing on the plus icon which shows in the bot­tom right of the seg­ments pane.

AND or OR For a Sin­gle Con­tainer
With the seg­ment builder open, let’s start with pulling over a con­tainer onto the seg­ment can­vas (in this case I’m using a visit con­tainer) and click on the link in the con­tainer that says “Click here to define Visit”. This will bring up the Rule Builder which allows you to apply cri­te­ria to the con­tainer. Under the Rule List you will be able to list one or mul­ti­ple cri­te­ria. Being that we are talk­ing about AND/OR state­ments you’ll need to add mul­ti­ple cri­te­ria. Notice that as you add cri­te­ria you have a nice “AND” or “OR” that appears next to each row. This is con­trolled by the Match drop­down at the top of the Rule Builder. When you choose “ALL of the rules” you are cre­at­ing an AND state­ment between each of the cri­te­ria and when it is set to “ANY of the rules” you are cre­at­ing an OR statement.

In the exam­ple of my screen­shot I am using an AND con­di­tion which would result in a seg­ment that con­tains vis­its that are vis­it­ing for the first time, were referred from Bing, and spent 5 to 10 min­utes on the site.

AND and OR For a Sin­gle Con­tainer
Now, what if we wanted to use the same seg­ment but look­ing at refer­rals from Bing OR Google? Look­ing at the Rule Builder inter­face you can quickly tell that you are only able to cre­ate an AND or OR state­ment between the cri­te­ria. So how would I seg­ment for first-time vis­its that spent 5 to 10 min­utes on the site and came from Bing OR Google? Answer: use mul­ti­ple con­tain­ers! So hit “OK” on the rule builder and let’s move on to the next section.

AND/OR for Mul­ti­ple Con­tain­ers
When work­ing with mul­ti­ple con­tain­ers keep in mind that you will now be work­ing with two sets of AND/OR state­ments. First, there is the con­di­tion that you des­ig­nate within the con­tainer. Addi­tion­ally, you have another drop­down above the seg­ment can­vas that spec­i­fies the con­di­tion between con­tain­ers. Select­ing “ALL of the fol­low­ing occurred” cre­ates an “AND” between con­tain­ers and select­ing “ANY of the fol­low­ing occurred” cre­ates and “OR” between containers.

Note: If you have also used the seg­ment builder for Data Ware­house or ASI you will likely notice that these other seg­ment builders, while sim­i­lar, do not have this drop­down. In these tools keep in mind that the con­di­tion between the outer con­tain­ers is always OR.

As I men­tioned in the last sec­tion, you can’t do a mix of AND and OR con­di­tions with a sin­gle con­tainer; how­ever, we can mix mul­ti­ple con­tain­ers to cre­ate the same results. So, if I wanted first-time vis­its that spent 5 to 10 min­utes on the site and came from Bing OR Google I could cre­ate two visit con­tain­ers that each con­tains the same cri­te­ria but with the refer­rer in one set to Bing and in the other set to Google. Then the final step is to adjust the drop­down to “Any of the fol­low­ing occurred”. Here is what the final seg­ment would look like:

AND/OR for Con­tain­ers within Con­tain­ers
Using the seg­ment builder you can place con­tain­ers within other con­tain­ers. When doing this the con­di­tion between the con­tain­ers is AND. Here is an exam­ple of a seg­ment where I want to look at vis­its that added prod­uct 12345 to the cart and pur­chased prod­uct 12345:

You’ll notice that even though the con­di­tion in the drop­down is set to “Any of the fol­low­ing” (which is an OR con­di­tion) the inner con­tain­ers are still AND. The drop­down only applies to the outer con­tain­ers. If you did want to cre­ate an OR for this seg­ment (vis­its that added OR ordered prod­uct 12345) then, sim­i­lar to the Bing/Google exam­ple ear­lier, you could move one of the page view con­tain­ers over to a sec­ond, outer visit con­tainer. The con­di­tion in the drop­down would then apply and you could adjust it to be OR.

In the case that you have cri­te­ria in the outer seg­ment and in the inner seg­ment the con­di­tion is still an AND. This applies wither the con­di­tion in the Rule Builder for the outer con­tainer is AND or OR.

This seg­ment would include vis­its where the visit num­ber is 1 AND (you can’t see the AND in the screen­shot but it is in the Rule Builder) a refer­ring domain of bing​.com AND had a sin­gle page with a cart addi­tion and a prod­uct of 12345.

Well, I hope you enjoyed that bit of fun. If you have ques­tions or com­ments use the response forum below or shoot me a tweet (@willeitner). I’ll tweet out to my fol­low­ers if I make any updates to the post.

  • http://www.the-omni-man.com Adam Greco

    Great post! This def­i­nitely helps as a ref­er­ence for one of the hard­est parts of Dis­cover. Thanks Kevin!

  • Jesse B

    This is a very cohe­sive and com­plete expla­na­tion of AND and OR state­ments in Dis­cover. Thank you very much!

  • Jes­sica P

    What about the “con­tains one of” option. I actu­ally use this quite often to do an AND and OR seg­ment with­out deal­ing with true nest­ing. I just space-delineate each keyword.

    Using your exam­ple, it would look like:

    Visit Bucket where:
    Refer­ring Domain con­tains one of: bing google
    AND Time spent per visit equals: 5 to 10 min­utes
    AND Visit Num­ber equals: 1

    • http://blogs.omniture.com/author/kwilleitner Kevin Willeit­ner

      Good obser­va­tion Jes­sica P. You can use the “con­tains one of” approach in some cases but there are lim­i­ta­tions. For exam­ple, if I was the ana­lyst for an out­doors retailer and I used the “con­tains one of” approach I would poten­tially also include vis­its from “climb​ing​.com” being that “bing​.com” is included in “climb​ing​.com”. In this case you would be includ­ing too much data in your seg­ment. To ver­ify if this is hap­pen­ing in your case, pull up a refer­ring domain report and search for “bing​.com” to see what addi­tional domains you may be unin­ten­tion­ally includ­ing, if any.

      Another case to be care­ful with is if we wanted an OR between mul­ti­ple phrases (like seg­ment­ing on vis­its that vis­ited pages named “Home Page” OR “Account Sum­mary”) then you would not be able to use the “con­tains one of” approach being that the val­ues them­selves con­tain spaces. The indi­vid­ual words would be used rather than the phrase as a whole. I hope that helps.

  • John Stans­bury

    Kevin,
    Great post. Discover’s seg­men­ta­tion engine is one of the the most pow­er­ful aspects of a truly great appli­ca­tion. If the Mar­ket­ing Chan­nels reports could use Discover’s seg­men­ta­tion approach rather than the cur­rent rule basis, I’d be ecsta­t­i­cally happy.

  • http://www.linkedin.com/in/petervo Peter

    Haha, I can indeed relate to the first para­graph of your post. Great arti­cle Kevin!

    Peter

  • Fei Hsu

    This is great post!

    How about the usage of Con­tains, and Con­tains All Of, or Starts with? I wanted to include a con­di­tion if an s.prop has ANY value at all on a page. The result seems to be dif­fer­ent than what I spec­i­fied. Can you pro­vide some insight?