| 204 | } |
| 205 | |
| 206 | function getExcludeBounceQuery(filters: Record<string, any>) { |
| 207 | if (filters.excludeBounce !== true) { |
| 208 | return ''; |
| 209 | } |
| 210 | |
| 211 | return `join |
| 212 | (select distinct session_id, visit_id |
| 213 | from website_event |
| 214 | where website_id = {{websiteId}} |
| 215 | and created_at between {{startDate}} and {{endDate}} |
| 216 | and event_type = 1 |
| 217 | group by session_id, visit_id |
| 218 | having count(*) > 1 |
| 219 | ) excludeBounce |
| 220 | on excludeBounce.session_id = website_event.session_id |
| 221 | and excludeBounce.visit_id = website_event.visit_id |
| 222 | `; |
| 223 | } |
| 224 | |
| 225 | function getDateQuery(filters: Record<string, any>) { |
| 226 | const { startDate, endDate } = filters; |