Best Practices for Writing Successful Queries
We recommend the following best practices to ensure you write successful queries.
Rule 1: Keep your queries simple and to the point
- Use Engagement Queries like a precision instrument.
- Do not write a query that is more complicated than it needs to be.
- Remember there is an inverse relationship between complexity and broadly useful results.
- Build up to complex queries systematically, confirming you are getting the sort of results you expect at each step.
Rule 2: Write your queries around well-thought-out business questions
Begin by asking the question in the form a business user would.
- Define your high-level objective.
- Define a set of questions that address each part of the objective.
- Write a query or set of queries that answer each question.
When you write your queries, you decide which events are most useful:
- Using the journey cutting and splitting filters, you can specify one or more Channels, Touchpoints, Lifecycle Stages, Activities, Interaction Points, Dates, or Assets.
- Using FOR you can specify such attributes as Proposition, Interaction Date, or Captured Value.
- Using WHERE, you can specify such attributes as Any Actions, Duration of Journey, and Count of Skips.
Rule 3: Use Journey Cutting and Splitting filters systematically
Work forwards and backwards systematically. For example, these three queries have TO (stage="Use") in common, and the Most Common Journeys that reach that stage are essentially the same. So you've revealed that all those who reach the Use stage come from the Awareness stage via Enrollment.
Discover journeys TO (stage="Use")
Discover journeys FROM (stage="Awareness") TO (stage="Use")
Discover journeys FROM (stage="Awareness") THROUGH ( (stage="Enrollment") ) TO (stage="Use")
Rule 4: Review and adjust your queries
Review the Journey Counts, to see the visitor flow (filtered count) between each Select statement. Look for unexpected bottlenecks and dead-ends and change the query accordingly to achieve expected or "normalized" results.
Modify your query as necessary - or rethink how to write it completely.