Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page URL not displaying correctly #12

Open
dorawei opened this issue Feb 17, 2022 · 5 comments
Open

Page URL not displaying correctly #12

dorawei opened this issue Feb 17, 2022 · 5 comments

Comments

@dorawei
Copy link

dorawei commented Feb 17, 2022

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...

@zhouhaixian
Copy link

metoo

@SukkaW
Copy link
Owner

SukkaW commented Mar 12, 2022

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.

@zhouhaixian
Copy link

zhouhaixian commented Mar 13, 2022

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.

@dorawei
Copy link
Author

dorawei commented Mar 13, 2022

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)?

@Cesirdy
Copy link

Cesirdy commented Apr 23, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants