@@ -53,7 +53,7 @@ export class AnalyticsService {
5353 FROM events
5454 WHERE
5555 event = '$pageview'
56- AND properties.$host = '${ this . config . baseSiteUrl } '
56+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
5757 ${ whereClause }
5858 ` ;
5959
@@ -118,7 +118,7 @@ export class AnalyticsService {
118118 FROM events
119119 WHERE
120120 event = '$pageview'
121- AND properties.$host = '${ this . config . baseSiteUrl } '
121+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
122122 ${ whereClause }
123123 ${ groupByClause }
124124 ORDER BY date
@@ -184,7 +184,7 @@ export class AnalyticsService {
184184 FROM events
185185 WHERE
186186 event = '$pageview'
187- AND properties.$host = '${ this . config . baseSiteUrl } '
187+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
188188 ${ whereClause }
189189 ${ groupByClause }
190190 ORDER BY date
@@ -237,7 +237,7 @@ export class AnalyticsService {
237237 FROM events
238238 WHERE
239239 event = '$pageview'
240- AND properties.$host = '${ this . config . baseSiteUrl } '
240+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
241241 ${ whereClause }
242242 GROUP BY properties.$pathname
243243 ORDER BY ${ orderBy } ${ order . toUpperCase ( ) }
@@ -276,7 +276,7 @@ export class AnalyticsService {
276276 FROM events
277277 WHERE
278278 event = '$pageview'
279- AND properties.$host = '${ this . config . baseSiteUrl } '
279+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
280280 AND properties.$geoip_country_code IS NOT NULL
281281 AND properties.$geoip_country_code != ''
282282 ${ whereClause }
@@ -449,7 +449,7 @@ export class AnalyticsService {
449449 FROM events
450450 WHERE
451451 event = '$pageview'
452- AND properties.$host = '${ this . config . baseSiteUrl } '
452+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
453453 ${ whereClause }
454454 GROUP BY channel
455455 ORDER BY ${ orderBy } ${ order . toUpperCase ( ) }
@@ -495,7 +495,7 @@ export class AnalyticsService {
495495 FROM events
496496 WHERE
497497 event = '$pageview'
498- AND properties.$host = '${ this . config . baseSiteUrl } '
498+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
499499 AND properties.$referring_domain IS NOT NULL
500500 AND properties.$referring_domain != ''
501501 AND properties.$referring_domain != '$direct'
@@ -550,7 +550,7 @@ export class AnalyticsService {
550550 FROM events
551551 WHERE
552552 event = '$pageview'
553- AND properties.$host = '${ this . config . baseSiteUrl } '
553+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
554554 AND properties.$device_type IS NOT NULL
555555 AND properties.$device_type != ''
556556 -- Filter out malicious SQL injection attempts (case-insensitive)
@@ -698,7 +698,7 @@ export class AnalyticsService {
698698 FROM events
699699 WHERE
700700 event = 'not_found'
701- AND properties.$host = '${ this . config . baseSiteUrl } '
701+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
702702 AND properties.pathname IS NOT NULL
703703 AND properties.pathname != ''
704704 ${ whereClause }
@@ -726,15 +726,18 @@ export class AnalyticsService {
726726 const { whereClause } = this . buildDateAndFilterClause ( options ) ;
727727
728728 // Build host filter - if provided, filter by specific host, otherwise use baseSiteUrl
729- const hostFilter = host ? `properties.$host = '${ host } '` : `properties.$host = '${ this . config . baseSiteUrl } '` ;
729+ const hostFilter = host
730+ ? `properties.$host = '${ host } '`
731+ : `(properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www.${ this . config . baseSiteUrl } ')` ;
730732
731733 const query = `
732734 SELECT
733735 properties.$host as host,
734736 properties.method as method,
735737 properties.endpointRoute as endpoint,
736738 properties.endpointName as name,
737- COUNT(*) as count
739+ COUNT(*) as count,
740+ any(properties.$current_url) as currentUrl
738741 FROM events
739742 WHERE
740743 event = 'api_playground_request_sent'
@@ -752,7 +755,7 @@ export class AnalyticsService {
752755 LIMIT ${ limit }
753756 ` ;
754757
755- const response = await this . client . query < [ string , string , string , string , number ] > ( query , {
758+ const response = await this . client . query < [ string , string , string , string , number , string ] > ( query , {
756759 name : `api-explorer-requests-${ this . getQueryNameSuffix ( options ) } -${ host || this . config . baseSiteUrl } `
757760 } ) ;
758761
@@ -761,7 +764,8 @@ export class AnalyticsService {
761764 method : row [ 1 ] || "" ,
762765 endpoint : row [ 2 ] || "" ,
763766 name : row [ 3 ] || "" ,
764- count : row [ 4 ]
767+ count : row [ 4 ] ,
768+ currentUrl : row [ 5 ] || ""
765769 } ) ) ;
766770 }
767771
@@ -816,7 +820,7 @@ export class AnalyticsService {
816820 FROM events
817821 WHERE
818822 event = 'feedback_submitted'
819- AND properties.$host = '${ this . config . baseSiteUrl } '
823+ AND ( properties.$host = '${ this . config . baseSiteUrl } ' OR properties.$host = 'www. ${ this . config . baseSiteUrl } ')
820824 ${ whereClause }
821825 ORDER BY timestamp DESC
822826 LIMIT ${ limit }
0 commit comments