Adding a Hit Counter to old website?

gurtch

Forum Enthusiast
Messages
386
Reaction score
421
Location
Beach Haven NJ, US
My web site is ancient, but so am I (87). I designed, built and maintain it myself. I used MS Expressions web authoring software by buying the software and a Textbook "How to". My web provider, "Ipower" used to send me monthly statistics showing how many hits I had each month, but lately it is screwed up and shows Zero hits. See screen shot of their email. I went on line to get their help, and they were useless saying I should use a third party hit counter. I went on line and tried several. You specify what type of counter, and where it should start. It then generates code which I copied and pasted into my site on my PC, then published the changed pages. Non of them seem to work.
Any suggestions? Here is the screenshot of Ipower statistics:
Thanks a million.
Dave in NJ
My web site is www.modernpictorials.com
Screen Shot



ba77a69841b64416abdb3d7627856d91.jpg.png
 
Last edited:
I would imagine a lot of people these days use Google Analytics. I do.
Thanks David. Is Google Analytics free, or subscription? Also, I do not write code. Expressions web site design and layout is all done without coding.

Thanks

Dave
 
I would imagine a lot of people these days use Google Analytics. I do.
Thanks David. Is Google Analytics free, or subscription? Also, I do not write code. Expressions web site design and layout is all done without coding.

Thanks

Dave
I used Expression web for years at work. It is both a visual editor and a code editor.

Funny thing is when I checked my own website yesterday, I realised that it has been such a long time since I did proper site maintenance that I had forgotten how it works. Including how I installed analytics. My site is a self hosted Wordpress site using a theme I wrote myself, I'm guessing your site a basic flat HTML site rather than database powered so it should be straight forward (if tedious) to amend on a page by page basis.

Looking at the source code for my site, I can see from the code listing that there is a snippet of javascript in the header that provides the analytics, but I can't see how it got there. It doesn't seem to be hard coded into the header, nor is there any obvious plugin or widget that inserts it. I need to look more carefully and figure it out.

Getting back to your situation, Analytics is free but you do need to set up an analytics account with Google. This will give you an account id number you use to add your site to the Analytics system and access to the analytics backend where you can see all sorts of different reports, including live tracking of current visitors to your site.

To make this work, they provide you with a little piece of code that you have to add to the <head> section of your site and customise with the ID number of your account.

The tag code looks like this:

a31d6433ca7a413582e3a380680eee05.jpg.png

The TAG_ID is replaced with the ID of your account and the code snippet has to be placed just after the <head> tag on each page you want tracked.

Typically with a database powered website there will be a common <head> section that is automatically inserted into to each page, but because you hand built your site it depends on how you put it together. You might need to manually add the snippet to each page.

But your first step is to sign up for a free analytics account, get the account ID code and the analytics tag code. Judging by the confusing documentation google provide which is really aimed at the kind of specialist analytics people you find in corporate marketing departments rather than for private site webmasters, you might well be better off finding a Youtube tutorial that walks you through the entire process step by step.

p.s.

I'm not sure what kind of metrics you used previously, but I'm going to guess it was a typical server side package often provided by web hosts such as AWstats or Webalizer.

If you opt for Google Analytics, you should find it more accurate (and likely to show less traffic than other packages) because it works by counting the number of times the analytics tag is called, rather than by simply counting http requests like the traditional server metrics.

These simpler metrics tend not to filter out bots and search crawlers and they double count things like images, css code files and other support files that are needed to create a single page. This accumulation of hits can lead to a grossly inflated hit count for your site. Google analytics is a lot more conservative and accurate.





--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 
Last edited:
Thank you David for the time and effort you spent to help me. Yesterday I signed up for Google Analytics and it supplied the code phrase. I copied and pasted it on each page (there are a lot of them) at the top of each page next to the page name. I saved the pages and uploaded them to my web service. If you go to my site, you will see that the code is displayed on every page exactly line I pasted it in. It looks ridiculous, And I will probably delete it today, it might frighten people away from my site. Expressions Web is the second site I built, the first used Microsoft Front Page; they discontinued it and I had to start from scratch using Expressions. I am a retired Engineer, and when I got my Masters my Thesis used Fortran and punched IBM cards, and I know nothing about writing code in today’s world.

Folks like you are the reason I come to this site.

Dave Gurtcheff
 
The two script bits Google Analytics uses are inside an <h1> tag, which is causing them to be interpreted as a header of human-readable text rather than performing the intended script functions.

You'd want to move the code bits Google gave out of there. A better practice would be to place them right before the </body> tag, although placing them elsewhere such as inside the <head> section isn't going to make much difference for a simple site.
 
Last edited:
Thank you David for the time and effort you spent to help me. Yesterday I signed up for Google Analytics and it supplied the code phrase. I copied and pasted it on each page (there are a lot of them) at the top of each page next to the page name. I saved the pages and uploaded them to my web service. If you go to my site, you will see that the code is displayed on every page exactly line I pasted it in. It looks ridiculous, And I will probably delete it today, it might frighten people away from my site. Expressions Web is the second site I built, the first used Microsoft Front Page; they discontinued it and I had to start from scratch using Expressions. I am a retired Engineer, and when I got my Masters my Thesis used Fortran and punched IBM cards, and I know nothing about writing code in today’s world.

Folks like you are the reason I come to this site.

Dave Gurtcheff
EDIT:

Oops!

Almost, but not quite right, almost there.

The Google code was inserted in slightly the wrong place and is corrupting the page.

What you did is you pasted the google tag code into your H1 main heading. It also looks to me like the < and > bracket characters got converted into what are called html entity codes which doesn't help because it means the browser thinks your new tag code is actually plain text that is part of the main heading. Which is why it is displaying it as text on the page, rather than executing it as javascript.

It's easy enough to fix, you'll just need to remove the code from where it currently resides and place it outside the H1 tag. You'll also need to replace the html entity codes for the < and > characters and turn them back into brackets.

The best way to do this is to switch Expression web from visual editor to code view mode so you can see the actual HTML.

Do not panic! It just needs a bit of care and some cut and paste. I wanted to provide step by step instructions here with screenshots, but it seems I have lost my copy of expression web, which makes things tricky to show.

I'm going to attempt to find and install a copy, then I can do some screenshots explaining what you need to do.

--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 
Last edited:
1. I downloaded your broken home page and opened it in a copy of MS Expression web

a7037feddcb24e34b1faa97a6406a79c.jpg.png

The above screenshot shows the default view, with the page opened in "Design" view.

[Click the "Original size" link below the image for a bigger view]

What we need to do first is to change the view to code view. I highlighted the little "code" tab with a blue circle and arrow. Click the code tab, to change the view to the code editor.

2. Expression web will now show the page as a code listing like this:

84fa2240fc034c08a411a6d2dbf94b79.jpg.png

DO NOT PANIC!!!

I know it looks tricky but we are only going to fix one tiny bit.

The problems are all in lines 64 to 69.

The easiest way to fix this is just to delete those lines and paste in the fixed code. The problem is how I get the fixed code to you. I think if I attempt to paste HTML code into this post, something will go horribly wrong! I think what I will do is put the code in a text file on my website.

EDIT: Here you go:

https://www.whisperingcat.co.uk/scans/fixedcode.txt

Delete lines 64 to 69. Add some blank lines to make space, then copy and paste in this piece of fixed code and save.

I suggest doing this just on your home page, upload it and test it to make sure it works. Worry about the other pages later.

Once you are happy you've successfully fixed the home page, you should be able to log in to analytics and have a look to see whether it is collecting stats. I suggest getting some people here to visit your home page, then look in the analytics live report to see if you can see them in the stats.

Once we have this working, we can then look at the other pages. Because every page has its own title, the code I supplied will have to be adjusted to display the correct page title on each page. A pain I know :-(

You may also find that the line numbers are not the same on every page, so check that carefully before doing anything to the other pages. But start with the home page, fix that and get analytics working before moving on to the other pages.



--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 
Last edited:
David : I just saw your post. Above and beyond the call of duty. I am now reading this on my iPad. I will open it later on my PC, and print out your instructions. As a senior, I find it easier now to have printed instructions in front of me rather than read instructions, commit to memory, then try to implement.
Dave
 
David: I followed your instructions and attempted to fix the Home Page only. I deleted the code in lines 64 to 69, and added some blank lines, and pasted in the code you supplied. I saved and published to my Site Provider. When I checked it I had deleted the Home Page Photograph and the Page Name. I opened Expressions in Design View, and put the photo back in and added the page description, saved and republished. By doing that I don't know if I screwed up the code you supplied.
 
OK, I've checked the page source code.

It looks like the google tag code is properly formatted and separate from the HTML. In theory it should now be working.

There is a small styling error that has been introduced whereby the Heading "Modern Pictorials" and the line of descriptive text that follows that starts "A site devoted to...." have been joined together into one giant heading but we can fix that later.

If you log into your new google analytics account, you should be able to see some activity occurring.

The home page of your analytics account should look something like mine:



2d395014cf324db6b06d53178b56dbf7.jpg.png

The bit we are immediately interested in is the square white box on the right called "Active users in last 30 mins". It takes a while for stats to be compiled into reports but that box should operate pretty much in real time and update within a few seconds of users visiting your site.

If you see a number other than 0 in that box it tells you analytics is working.

Can you have a look and let me know what you see...





--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 
YAHOO! You did it! I logged in and it showed a visitor from the UK. I am like a kid at Christmas. I cannot thank you enough.

Dave
 
YAHOO! You did it! I logged in and it showed a visitor from the UK. I am like a kid at Christmas. I cannot thank you enough.

Dave
That's good news 👍👍👍

But we are not done yet. We need to make sure all the other pages are fixed as well.

Suggest which page to do next and I'll check the current code on that page and see which lines need fixing. We should do the pages one at a time in case anything goes wrong so we only have one page to fix at a time!

By the way, I got a bit caught up in story of the returned lost negatives. How on earth did they make their way back to you after all that time.

--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 
Last edited:
YAHOO! You did it! I logged in and it showed a visitor from the UK. I am like a kid at Christmas. I cannot thank you enough.

Dave
That's good news 👍👍👍

But we are not done yet. We need to make sure all the other pages are fixed as well.

Suggest which page to do next and I'll check the current code on that page and see which lines need fixing. We should do the pages one at a time in case anything goes wrong so we only have one page to fix at a time!

By the way, I got a bit caught up in story of the returned lost negatives. How on earth did they make their way back to you after all that time.
I suggest we fix the page NEW WORK next. A complete stranger living about 100 miles from here was selling her house that she inherited from her parents. While cleaning out a closet she discovered a fire proof steel box. In it were 250 rolls of 645 size negatives. Each frame was in an individual glassine envelope, 16 frames per role. Each roll was sequentially numbered. They had been stored in the dark at ambient temperature all those years. My father’s name was written on an old envelope also in the box. The woman looked me up on the internet and found me. She hand carried them from her home all the way to LBI where we live. Word eventually got out about the negatives, and I was invited to do a two man show at the local Foundation of the Arts. It took me a year and a half to print, mount, mat and frame both my work and my Dad’s work. My biggest prints are 24” x32”. I have a high end film scanner, and Some of my Dad’s negatives were also printed that large. Look at my B&W images, then look at my Dad’s images, and it is hard to tell who did what, even though I had never seen the negatives, He died when I was three.

Dave
 
YAHOO! You did it! I logged in and it showed a visitor from the UK. I am like a kid at Christmas. I cannot thank you enough.

Dave
That's good news 👍👍👍

But we are not done yet. We need to make sure all the other pages are fixed as well.

Suggest which page to do next and I'll check the current code on that page and see which lines need fixing. We should do the pages one at a time in case anything goes wrong so we only have one page to fix at a time!

By the way, I got a bit caught up in story of the returned lost negatives. How on earth did they make their way back to you after all that time.
I suggest we fix the page NEW WORK next. A complete stranger living about 100 miles from here was selling her house that she inherited from her parents. While cleaning out a closet she discovered a fire proof steel box. In it were 250 rolls of 645 size negatives. Each frame was in an individual glassine envelope, 16 frames per role. Each roll was sequentially numbered. They had been stored in the dark at ambient temperature all those years. My father’s name was written on an old envelope also in the box. The woman looked me up on the internet and found me. She hand carried them from her home all the way to LBI where we live. Word eventually got out about the negatives, and I was invited to do a two man show at the local Foundation of the Arts. It took me a year and a half to print, mount, mat and frame both my work and my Dad’s work. My biggest prints are 24” x32”. I have a high end film scanner, and Some of my Dad’s negatives were also printed that large. Look at my B&W images, then look at my Dad’s images, and it is hard to tell who did what, even though I had never seen the negatives, He died when I was three.

Dave
Amazing. Any idea how the box ended up in that closet?

i checked the new work page. It doesn't look like the code has been added to that page yet and nothing has been corrupted. I've tweaked the code at https://www.whisperingcat.co.uk/scans/fixedcode.txt to remove the code fix we added to the home page, leaving just the google tag.

All you need to do with this page is go to the code view in expression web as I showed you before, find line #43 (which says </style>), click after the text on this line and press return a few times to create some blank white space. Then click somewhere on that white space and paste the contents of the text file in the link above. Doublecheck to make sure it hasn't accidentally been pasted somewhere it shouldn't be, if all well, save and upload.

I've got to go to bed now, it's gone midnight here, but I'll visit the page and leave my browser running overnight so analytics should see me in the real time report.

Speak again tomorrow.

D.

--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 
Last edited:
David: which page do I add the new text you provided? I looked at both NEW WORK and HOME pages and neither has the text you described. I think I am missing something ( it’s an age thing). I will not make any changes right now so I don’t screw up what we have done so far.

Dave
 
David: which page do I add the new text you provided? I looked at both NEW WORK and HOME pages and neither has the text you described. I think I am missing something ( it’s an age thing). I will not make any changes right now so I don’t screw up what we have done so far.

Dave
Here is a code listing of the end part of the new work page https://www.modernpictorials.com/new_work_image_gallery.html (as you would see it in the code view tab in expression web).

b6aa58becb3f4605bd64a61b5729f356.jpg.png

I've marked that little white space at line 71.

CORRECTION: silly me, I meant to put the arrow at line 73!

You could paste the fixed code into any blank space in the page, but line 73 seems convenient to me. If you need to, hit the return key a few times to expand the white space, then post in the revised text from that link I provided.

--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 
Last edited:
I think I did it correctly. What exactly will that change do? Will it make Google Analytics now track two pages as opposed to just the Index (HOME) page? I visited your web site and left you a note. Congrats on your LRPS!

Dave
 
I think I did it correctly. What exactly will that change do? Will it make Google Analytics now track two pages as opposed to just the Index (HOME) page? I visited your web site and left you a note. Congrats on your LRPS!

Dave
Code looks good to me.

Yes, you should now see that two different pages are being tracked.

There are a lot of standard reports in analytics and they usually have weird names so it takes a bit of hunting around, but there should be a report somewhere that lists the pages on your site and the traffic per page.

If you add the same code to every page in a similar way, visits to every page will be recorded.

I usually make use of the report in the engagement section called Pages and Screens. It has a table listing the data for all your pages.

here's a screenshot of what mine looks like



180546c84223455baf1f642de910a70a.jpg.png



--
2024: Awarded Royal Photographic Society LRPS Distinction
Photo of the day: https://whisperingcat.co.uk/wp/photo-of-the-day/
Website: http://www.whisperingcat.co.uk/
DPReview gallery: https://www.dpreview.com/galleries/0286305481
Flickr: http://www.flickr.com/photos/davidmillier/ (very old!)
 

Keyboard shortcuts

Back
Top