mercredi 29 juin 2016

Refresh page at intervals

I am Using the following code to refresh the webpage at particular interval. The page seems to refresh but the Google Analytics code is not getting loaded. I have the Google Analytics code also for reference below. I am still a newbie to coding, Would be really great if you could help figure out why the Analytics code is not loading.

Refresh Code

<script type='text/javascript' src='http://ift.tt/292atIw'></script>
<script type="text/javascript">
function refresh_handler() {
    function refresh() {
       var url = $(location).attr('href');
       window.history.pushState("", "<?php echo $meta_title; ?>", url);
       $("#ajaxanalytics").load("http://ift.tt/292ThPu"); 
    }
    setInterval(refresh, 60*1000); //every 1 minutes
}
$(document).ready(refresh_handler);
</script>

Analytics Code

<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','http://ift.tt/1pxBd1V','ga');

  ga('create', 'UA-XXXXXX-X', 'auto');
  ga('send', 'pageview');

</script>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire