Support » Fixing WordPress » Google Analytics code not working after virus recovery

  • Resolved loveinindia

    (@loveinindia)


    I’d had my WordPress site Love in India infected by virus a few days ago. Please find the details of the problem here.the details of the problem here.
    Please note that during this period, I was unable to log into WP but my site was up throughout the period.
    Now after the issue has been resolved by removing infected file and I can login, I find the GA code is not working.
    The code I regenerated from GA and have now pasted in my header again is:

    <script type="text/javascript">
    
      var _gaq = _gaq || [];
      _gaq.push(['_setAccount', 'My UA code']);
      _gaq.push(['_setDomainName', 'loveinindia.co.in']);
      _gaq.push(['_setAllowLinker', true]);
      _gaq.push(['_trackPageview']);
    
      (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
      })();
    
    </script>

    But this looks very different from what was used earlier. I of course don’t remember what was the exact code that was being used so far, and may be I’m mistaken, but does anyone have any idea whether GA tracking code format has been updated recently?

    Also, since my site was never down, I’m wondering – why would Google need to index it again, if that’s the case?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I of course don’t remember what was the exact code that was being used

    This is a question for Google – login to Google Analytics and review/ask them…

    You used the code two times

    <script type=”text/javascript” async=”” src=”http://www.google-analytics.com/ga.js”>
    <script type=”text/javascript” async=”” src=”http://www.google-analytics.com/ga.js”>

    I think you have to delete one of them.

    I have not made any changes because I didn’t understand what to change. But ever since the new code pasted above has been inserted data is being captured fine.
    Thanks a lot everyone for helping out. 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Google Analytics code not working after virus recovery’ is closed to new replies.