comprehensive-rust icon indicating copy to clipboard operation
comprehensive-rust copied to clipboard

Track number of 404 hits

Open mgeisler opened this issue 2 years ago • 6 comments

It would be nice to know how many times our 404 page is shown to people. That way we could try to find and update pages with broken links.

I think doing this would require setting the input-404 option to a page where we can add the necessary Google Analytics code.

mgeisler avatar Mar 09 '23 10:03 mgeisler

Hi @kushayb!

Nice to meet you! I don't actually know how we would solve this — is it clear what I am trying to do? We use Google Analytics (GA) on the pages (add in index.hbs) and I would like to somehow monitor our broken links.

When people go to a page that doesn't exist, they're sent to a 404 page generated by mdbook (I think this works because of a GitHub default as well). I'm thinking that this page could somehow tell GA about the 404 error.

You would need to read up on the options here a bit so we can make a plan. As I said, I don't have a ready-made plan for this, so I would be relying on you for that :smile:

mgeisler avatar Jun 23 '23 08:06 mgeisler

Is anyone working on this issue? This is my first time contributing and I would like to take up this issue.

ED-1-0 avatar Jul 05 '23 18:07 ED-1-0

Hi @ED-1-0, I don't think there has been any work done on this — or at least I haven't seen any.

Does my description above make sense? I hope you know GA to some extent? I'm not an expert in it myself, but I hope we can figure something out together.

mgeisler avatar Jul 06 '23 14:07 mgeisler

I'm not familiar with GA but from what I understand, you want to track the number of times your 404 error page is shown. One of the options is to add input-404 setting in index.hbs file. Correct me if I am wrong.

ED-1-0 avatar Jul 07 '23 06:07 ED-1-0

One of the options is to add input-404 setting in index.hbs file. Correct me if I am wrong

That right, but we need to figure out what to put in the page you reference in that setting. That is where knowing Google Analytics comes into the picture.

mgeisler avatar Jul 07 '23 07:07 mgeisler