Forum Moderators: open

Message Too Old, No Replies

Do I need this code

What does this code do

         

Adam5001

4:36 pm on Jul 11, 2018 (gmt 0)

5+ Year Member



I'm updating my site, and there's some code there from the early days, that I was advised to include on each page.

I have two questions.

1) What does (did) it do?
2) Do I still need it?

Below is the code.

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ?

"https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-
analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>

<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-6260380-1");
pageTracker._trackPageview();
} catch(err) {}
</script>

Help!

lucy24

6:00 pm on Jul 11, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Do you use Google Analytics, or do you not?

In any case, having the identical code on every page is absurd. Put it in a shared include file, using either SSI or php, whichever best suits your site. And then, whenever you need to tweak the code, you only have to tweak it in one place.

tangor

12:48 am on Jul 12, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Agreed ... also consider that for some (see other posts on this site) there's some question as to whether g analytics delivers the goods these days. If you aren't using it, leave it out.

keyplyr

5:56 am on Jul 15, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi Adam5001 and welcome to WebmasterWorld [webmasterworld.com]

ergophobe

5:42 pm on Jul 19, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



This is outdated Google Analytics code. Still works fine, but if you are updating your site, now is the time to switch to Universal Analytics or perhaps its more recent successor.

[developers.google.com...]

Leosghost

7:02 pm on Jul 19, 2018 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



but if you are updating your site, now is the time to switch to

Matomo..previously known as Piwik..all of the analytics, non of the nasty Googly tracking of your visitors ..