Track where 404s come from in Google Analytics? - google-analytics

I want to figure out how visitors are getting to my /error404 page. I want to see what URL they attempted to visit (e.g., http://mydomain.com/iloveyou) before they received the 404, so I can see what content my users think I have.

You can get by without touching your source files--as long as your error pages/templates are tagged, that's all you need, configuration-wise.
As an aside, our error page template all look about the same so to clearly allow a person viewing the GA data to distinguish the various error pages, we annotate them by passing in a descriptive string to _trackPageview(), e.g.,
pageTracker._trackPageview("404_removed_directory");
Needless to say, this annotation is just for GA, it isn't shown to the user.
So w/r/t viewing the information you are after--i.e., page paths in which one of your error pages is the terminus--you can use either the GA data browser or either of the two GA APIs.
Using the GA Data Export API
I would code my Request this way:
dimensions=ga:previousPagePath
metrics=ga:pageviews
filters=ga:nextPagePath%3D~SomeErrorPage.html
# or if your API client does not require URL encoding, then:
filters=ga:nextPagePath=~SomeErrorPage.html
If you haven't used the GA Data Export API, the Data Feed page shows a complete API Request that you can use as a template.
In addition, Google's Data Feed Query Explorer is a decent sandbox to interactively test the queries that comprise your Requests.
Using the GA data browser
From the main Dashboard, on the left-hand side panel, click Content, then click Overview underneath it. To the right, in the main window, you will see a heading under the Pageviews chart, called Navigation Analysis, this has two linked options under it, Navigation Summary and Entrance Paths. clicking the latter will reveal the view shown below. In the textbox, just enter the name of your error page to get the entrance path for that error page.
Finally, relying on your server access log for this information is less reliable for all of the usual reasons (caching, etc.), in addition, given your question is specific to GA, i assume you already use GA, so modifying your config file, and parsing the activity log, if you are not already doing so, is a lot of trouble, compared to getting a more accurate count of the same data through a channel (GA) you have already set up.

You don't need google analytics for this - just expand the logging of your webserver to log referer data for this specific page. With this information you can see where the majority of people are coming from.

Related

Metrics and dimensions are not showing up for hits of type 'event'

I have a fully functional and working code (written in C#) which purpose is to track some hits to the specified GA property. This code has been tested and still works successfully. It adds some predefined dimensions (like App Version) to each hit and a several custom metrics to a certain hit types (like event with a certain Event Action).
So far so good everything works flawlessly when taking into account the first property to which these hits are being sent. Also everything is fine when I set up a brand new GA property and track my hits to it - that is, I'm able to see events in Realtime reports, and events show up in custom reports after a while so that I can see my custom metrics.
The issue is that when I try to send absolutely the same hits to the existing property which had been created and configured ages ago - there is no both dimensions (even predefined) and custom metrics in my custom reports. I see these events in realtime and behavior reports, and I'm even able to create a custom report against events count - but that's it. I'm able to use for example Day of the month as a primary dimension, but when I try to use App Version as a dimension or my custom metrics as report metrics - it says "There is no data for this view.".
I've already tried everything I could, have read almost every post about custom definitions in Google and viewed almost each related SO question and answer - still with no luck.
We use measurement protocol
There is a correct User Agent being sent with each hit
17 days has passed since my first attempt to track these hits with existing property
There is no filters and segments at all
There is only one view
For me it looks like a property misconfiguration, but I've inspected each configuration page (I have all possible rights granted) and have not found anything related.
Will appreciate any help with this issue.
UPD: The hit itself (with the sensitive data replaced):
t=event&ec=session&ea=connection_end&el=b225d53a-6bb2-8021-f7b5-ae7004ae0a00&cm1=174960&cm2=1751494&cm3=479033&tid=UA-XXXXXXX-X&cid=4119e77f-be87-4530-04d3-33882f8eea77&v=1&av=XX.XX.99.555&an=my-awesome-app&aid=app.awesome.my
UPD: Here is what I'm trying to achieve (screenshot was made at the test property, where everything works like a charm):

Firebase long dynamic link analytics

The Dynamic Links documentation states:
If you don't need to track click data and you don't care if the links are long, you can manually construct Dynamic Links using URL parameters
I'd prefer to use the long URLs (easier dynamic creation) but the above docs imply I'll lose click data. The campaign parameters can still be given to this URL, and the link is still hosted at Firebase, so it's not clear to me which analytics we'll lose here. Does anyone know the full details on this statement?
Firebase team responded that the UTM data is still recorded, it's just the click count which is lost in the Firebase console.

How can I track visitors’ paths from one page to another with full URLs?

Say I have two pages on a site called “Page 1” and “Page 10”. I'd like to be able to see the paths visitors take to get from “Page 1” to “Page 10” with full URLs intact. Many of the URLs (including those for “Page 1” and “Page 10”) will include query strings that are important.
Is this possible? If so, how?
Try using behavior flow reports. The report basically shows you how visitors click through your website. There are a lot of ways to customize the report, with which you will need to play around to really answer your question. By default, the behavior flow focuses on entry and exit points of visitors, regardless how many times they hit the different subpages in between. However, I'm sure you can set appropriate filters and settings to answer your question.
I use two methods for tracking where people have been on my website:
Track and store the information in my own SQL database. (details below)
Lead Forensics (paid subscription, but you can do a trial).
For tracking and storing my own data, I record unique visitors based upon the IP Address they're connecting from and then have a separate table that records all page views that links back to the unique visitor table.
Lead Forensics data simply allows me to link up those unique visitors with actual companies that have viewed my website.
Doing it yourself means you don't have to rely on Google working for your records to work, and in my experience Google Analytics tends to round numbers so you don't get a true indication of numbers, and also you can remove bots and website trawlers from your data by tracking the user agent string.
As a somewhat ugly hack you could use transaction tracking. If you use the same transaction id multiple times subsequent products will be added to the existing data. So assign an ID at the start of the visits and on each page record a transaction with the current page url as product name (and the ID as transaction id). This will give you the complete path per user (I am frankly not to sure how this is useful - at some point you probably want aggregated data. Plus each transaction and product counts towards your quota for interaction counts, so on a large site you might run over the 10mio hits limit).
you can do it programatically
have a MAP in the backend which stores the userId (assuming u would have given a unique ID at the time of login to each user) with a list of Strings(each string being URL visited by that user)
whenever the user hits another URL from Page 1(and only from page1, check it using JS), send a POST request to backend with the new URL in its data section.
In the backend, check if the URL is of Page 10 and if not, add this URL as a string into the MAP for that corresponding user
Finally, when the user clicks on the Page 10 URL, you know the URLs in the way from Page 1 to Page 10 and so use them.
Though if I consider JS and I have not misunderstood your question, we can get the previous URL from request header information using document.referrer.
Are you trying to do it from 'Google Tag Manager'? I am not sure whether you are trying to trace the URLS in clientside or server side?

Unsure if Google Analytics is combining metrics for URLs with segments

Google Analytics is recording a page called ".../form", but separately it is also reporting redirects to that page as "/form?/=test"
Under Site Content they are both listed separately.
In a case like this am I right to assume these are separate metrics that need to be added together to provide a truer picture of activity.
Or is it a case where ".../form" also includes all traffic from "/form?/=test"
EDIT: The URLs were due to redirected legacy traffic and since both were recording data in GA just trying to see about data collected to date.
It seems to me that absolute URLs are needed rather than relative.
Is there somewhere to point to "http://my.domain.com/form" instead of just "/form"?

Determining search query of guest user

In my app, there's a requirement to track search queries, which individuals to the app. The point here is to track specifically individuals/search_queries, i.e. I want to be able to say:
User 10.20.30.40 (IP is derived from client, ok) came to my website
from Google's search results page of 'hello world' query
Is that even possible?
I investigated the problem a bit. It turned out, that when the user on Google Search result page clicks a link and gets to the underlying page, the referer doesn't contain the search query. Say, for example, I entered a "Hello world" query...
I open google and enter a "Hello world" query;
I see a serach result page with a link to wikipedia on top; I follow it
I enter "document.referrer" in consonle to see:
http://www.google.com.ua/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CGkQFjAA&url=http%3A%2F%2Fru.wikipedia.org%2Fwiki%2FHello%2C_world!&ei=HZ0fUIXTIordtAau54GwAQ&usg=AFQjCNHSAHv8NwVNdaxMvh0OhIxs6Zb1rQ&sig2=a8tEGTBNcFWOPykloXj_Xg
There's a &q= param with a blank value, preventing me to figure out the query the user entered.
I believe Google internally uses some of the query params (i.e. ved, ei, usg or sig2) from the URL above to keep track of query used to get to the site, and thus gatehr the statistics about which queries are used mostly to the get to the website. I couldn't find any information regarding how to use them.
In the meantime, Google Analytics would only gather a general statistics, not for individuals. Yet I noticed that there's an ability to use Custom Variables. Is it possible to use them somehow in order to track query the user came with? If so, wouldn't it be a violation of Google Analytics Terms Of Service?
So again: is there a way to know a search query one came to the site with?
This is not possible. Google erases the value of q parameter, so instead of
`?q=search+query`
one always observs.
`?q=`
Though, Google provides another way (the so called convinient one) to know which queries were used to come to your website: Google Analytics.
Also, it's impossible to track user_ip/search_query pair due to Google Analytics ToS.

Resources