(filters: QueryFilters = {})
| 181 | } |
| 182 | |
| 183 | function getCohortQuery(filters: QueryFilters = {}) { |
| 184 | if (!filters || Object.keys(filters).length === 0) { |
| 185 | return ''; |
| 186 | } |
| 187 | |
| 188 | const cohortMatch = (filters as any).cohort_match; |
| 189 | const cohortActionName = (filters as any).cohort_actionName; |
| 190 | |
| 191 | const filterQuery = getFilterQuery(filters, { isCohort: true, cohortMatch, cohortActionName }); |
| 192 | |
| 193 | return `join |
| 194 | (select distinct website_event.session_id |
| 195 | from website_event |
| 196 | join session on session.session_id = website_event.session_id |
| 197 | and session.website_id = website_event.website_id |
| 198 | where website_event.website_id = {{websiteId}} |
| 199 | and website_event.created_at between {{cohort_startDate}} and {{cohort_endDate}} |
| 200 | ${filterQuery} |
| 201 | ) cohort |
| 202 | on cohort.session_id = website_event.session_id |
| 203 | `; |
| 204 | } |
| 205 | |
| 206 | function getExcludeBounceQuery(filters: Record<string, any>) { |
| 207 | if (filters.excludeBounce !== true) { |
no test coverage detected