Google Analytics shows Direct User Interaction to Internal Pages - google-analytics

I have a website which contains 3 webpages(1 Landing and 2 Internal pages)
For example, www.exmaple.com is my website and the User should log in here and then only he/she redirects to www.example.com/page1 and he can finish some info and he can go to www.example.com/page2.
I have created google analytics for my website (www.example.com) and added analytics code to all 3 pages(page1 and page2). But User flow of google analytics shows some of the users are directly accessing to page1 and page 2
But I am sure all users will come to landing page first (www.example.com), Can anyone help me how they can access page1 and page 2 directly (I am sure it is not because of bookmarks)

If your site uses redirects, the redirecting page becomes the landing page's referrer. Depending on how you do the redirect you can lose the referrer.
So if your original referrer is www.google.com, your Google Analytics code is not loaded in this page and after redirect the new referrer becomes www.example.com, therefore on the actual landing the referral is itself (www.example.com) and no longer www.google.com and the source of session is Direct.

Related

Is there a way to track an URL traffics if the page doesn't exist but was directed to a working page?

A user enters https://example.com/mypage on the browser
.httaccess redirects to https://example.com/myfinallandingpage
I would like to track the traffics of /mypage.
/mypage is not an actual page, but /myfinallandingpage is a working page.
Does anybody know a way to do this?
Out of the box you can't measure server-side redirects such as 301 or 302 since the browser JavaScript, and thus Google Analytics won't be executed on the redirect source pages.
However you can by doing a little customization:
Insert a URL parameter on the redirect destination page eg https://example.org/destination-page?ref=https://example.org/source-page and track whatever you want on that destination apge
Perform server-side tracking: you could handle your redirects at PHP level, allowing you to use a GA server-side tracking library with GA Client ID retrieved via the cookies in HTTP headers

Universal Analytics and login redirect

As part of user flow on my site, user is redirected to a different domain that is not under my control, where he logs in and is then redirected back to my site.
Google analytics fail to correctly display the user flow, showing the callback URL as a new landing page, which is obviously wrong.
I am considering rewriting referrer on the callback page, but it seems like a very hacky solution to a common problem.
Is there a standard way to connect the flow after a redirect?
You must enter the domain of that site in the Referral exclusions list in the Properties settings.

Google analytics and Oauth (Facebook login)

TL;DR;
Facebook login makes the original referral URL change since and in GA it will look like they originally came from a Facebook.
We have the following problem using Google Analytics (UA) for Facebook (Oauth) login:
user lands on /page/1?utm_campaign=aaa and GA session is created with correct initial referrer, campaign etc.
user visits a few other pages and decides to register using Facebook
Facebook login makes the user's browser to go to facebook and come back which changes the referral and thus creates a new GA session
When user lands back on our callback url we fire an event that is converted to goal in GA
The problem is that all users who register using Oauth have the referral set to Facebook and the landing page to the page where they land after Facebook's callback because that's when GA "resets" the session :( .
Is there a way of joining the two sessions in GA and making it know that it is the same user all the time so that Facebook registers keep the full information on initial referrer, landing page, UTMs etc. ?
Follow FB SDK example and OAuth dialog will open in a popup window.
It will remove the issue with GA.
Most of OAuth providers that I know also support opening a dialog in a popup window.

Facebook Share a page with a redirect?

Our site is a members only store, in order to view a product- you need to be a member of the site and logged in.
If a user attempted to go direct to a product without first logging in or registering, the site will redirect them to the landing page where they will need to login / register.
This works great.
Except - if a user wants to share a product on Facebook, we'd like the products details to be shared not the landing page's.
Is it possible for a page with a redirect to be shared on Facebook?
Many thanks :)

How to track ecommerce data of users who get redirected from the old site to the new site?

I am switching from my old domain to my new domain. The new site is up and running and I already set up 301 redirects in the old site.
I'm wondering if it is possible to track the ecommerce data of users who get redirected from the old site in Google analytics?
The simplest way is to add utm_* parameters to your redirection url. Inside of 301 redirection page you could place for example:
http://www.newwebsite.com/?utm_campaign=Redirect
You will see all the redirected users coming from source traffic of type "Campaign" with name "Redirect". You are able than to use it as a filter in e-commerce reports.

Resources