google analytics - Calculating number of sessions with a certain pagePath -
i trying calculate number of sessions having 1 specific page path @ least 1 of hits within session ("my-path"). need assure not match example "my-path-2" match "my-path/something", using following expression:
nth(1,split(nth(1,split(hits.page.pagepath,'/')),'?'))
the complete query yields incorrect results , following:
select date, hostname, pagepath, exact_count_distinct(id) sumvisits ( select date, hits.page.hostname hostname, id, pagepath ( select (nth(1,split(nth(1,split(hits.page.pagepath,'/')),'?'))) within record pagepath, date, hits.page.hostname, hits.type, concat(fullvisitorid, string(visitid)) id [my-table] having pagepath ="my-path" ) ) group date, pagepath, hostname
what doing wrong? query works using contains (selecting much) not using nth , split functions.
did try:
nth(2,split(nth(2,split(hits.page.pagepath,'/')),'?'))
sometimes saved paths start "/" "/my-path/p/a" instead of "my-path/p/a"; , in case when take 1st element "split" instead of 2nd one; query return empty string.
Comments
Post a Comment