cloudflare-workers-async-google-analytics
cloudflare-workers-async-google-analytics copied to clipboard
Page URL not displaying correctly
After swtiching to CFGA pageview report by url (or Page, default dimension) is not showing the right items, seems all views counted to "/", but Page Title report is showing the correct titles.
Any suggestions would be greatly appreciated...
metoo
After swtiching to CFGA pageview report by url (or Page, default dimension) is not showing the right items, seems all views counted to "/", but Page Title report is showing the correct titles.
Any suggestions would be greatly appreciated...
The script doesn't report the URL directly. It relies on the server to read the request from the Referer
header (where the page URL should be).
Since the URL hash is meant to stay in the browser only and never be sent to the server, If you are deploying a SPA and using hash-based routing and that might happened.
After swtiching to CFGA pageview report by url (or Page, default dimension) is not showing the right items, seems all views counted to "/", but Page Title report is showing the correct titles. Any suggestions would be greatly appreciated...
The script doesn't report the URL directly. It relies on the server to read the request from the
Referer
header (where the page URL should be).Since the URL hash is meant to stay in the browser only and never be sent to the server, If you are deploying a SPA and using hash-based routing and that might happened.
const historyCreator = __VUEPRESS_SSR__ ? createMemoryHistory : createWebHistory;
const router = createRouter({
history: historyCreator(removeEndingSlash(siteData.value.base)),
routes: pagesRoutes,
scrollBehavior: (to, from, savedPosition) => {
if (savedPosition)
return savedPosition;
if (to.hash)
return { el: to.hash };
return { top: 0 };
},
});
However, I don't seem to use Hash routes.
After swtiching to CFGA pageview report by url (or Page, default dimension) is not showing the right items, seems all views counted to "/", but Page Title report is showing the correct titles. Any suggestions would be greatly appreciated...
The script doesn't report the URL directly. It relies on the server to read the request from the
Referer
header (where the page URL should be).Since the URL hash is meant to stay in the browser only and never be sent to the server, If you are deploying a SPA and using hash-based routing and that might happened.
It's a jekyll site with ordinary URL paths, but still most of the URLs not being captured. Weird thing is approx. 5% of views could be captured with the correct page URLs, the remaining 95% views just go to "/".
Not sure what's wrong with CF's Referer
to page_URL
... Any plans to implement a client side method of capturing page URLs (dl)?
I added 'dl=' + encode(document.URL)
in "cfga.js" to capture page URLs (dl)
and changed const pvData = `...&dl=${encode(page_url)}&...`;
to const pvData = `...&dl=${encode(getQueryString('dl'))}&...`;
in "worker.js".
it works for me