0

I have a script like

 <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("xx-xxxxxxx-x"); pageTracker._trackPageview(); } catch(err) {} </script> 

So how do i use it works in my site? Please help me to get the solution..

2
  • 1
    That is some seriously outdated analytics code and should, in this day and age, not be used at all. And if you add it to the header it might block the rendering of your page until the google code is loaded (which is why Google introduced asychnronous code), so if you must use it put it in the footer. Commented Feb 14, 2014 at 9:33
  • thanks for your usable suggestion.. Commented Feb 14, 2014 at 11:20

2 Answers 2

1
<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("xx-xxxxxxx-x"); pageTracker._trackPageview(); } catch(err) {} </script> 

Add this snippet in the header.php or head.php in your files, just before the end of the </head> tag.

Sign up to request clarification or add additional context in comments.

Comments

0

Go to Appearance>Widgets and add "Custom HTML" to any of your sidebar widgets and past the code in there.

Make sure to including the:

<script>...</script> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.