Welcome to WebmasterWorld Guest from 35.172.195.49

Forum Moderators: open

Message Too Old, No Replies

Do I need this code

What does this code do

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

New User

joined:June 24, 2018
posts:3
votes: 1


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!
6:00 pm on July 11, 2018 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:15934
votes: 889


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.
12:48 am on July 12, 2018 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member tangor is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Nov 29, 2005
posts:10569
votes: 1124


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.
5:56 am on July 15, 2018 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member keyplyr is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Sept 26, 2001
posts:12913
votes: 893


Hi Adam5001 and welcome to WebmasterWorld [webmasterworld.com]
5:42 pm on July 19, 2018 (gmt 0)

Senior Member

WebmasterWorld Senior Member ergophobe is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Apr 25, 2002
posts:8639
votes: 284


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...]
7:02 pm on July 19, 2018 (gmt 0)

Senior Member from FR 

WebmasterWorld Senior Member leosghost is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Feb 15, 2004
posts:7139
votes: 413


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 ..