Page 1 of 1

hidden codes and a theme

Posted: Wed Jan 04, 2017 3:04 pm
by Imajica
Morning,

I use statcounter and google analytics on my sites, normally I would just put these in the head area of the theme template but after reading with yellowled said in another thread I'm a little reluctant to add it where I normally do

Where would you have this code live?

Code: Select all

<!-- Start of StatCounter Code -->
<script type="text/javascript">
var sc_project=*******; 
var sc_invisible=1; 
var sc_partition=51; 
var sc_click_stat=1; 
var sc_security="*******"; 
</script>

<script type="text/javascript" src="http://www.statcounter.com/counter/counter.js"></script><noscript><div class="statcounter"><a title="free hit counters" href="http://www.statcounter.com/free_hit_counter.html" target="_blank"><img class="statcounter" src="http://c.statcounter.com/4138911/0/dcb5b7f0/1/" alt="free hit counters" ></a></div></noscript>
<!-- End of StatCounter Code -->

Code: Select all

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', '########-##']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>
John

Re: hidden codes and a theme

Posted: Wed Jan 04, 2017 5:00 pm
by Don Chambers
You can do that with the event plugin HTML-Code inside head (HTML-Head Nugget).

Re: hidden codes and a theme

Posted: Wed Jan 04, 2017 5:55 pm
by Imajica
awesome
Thank you

I just love this framework

Re: hidden codes and a theme

Posted: Thu Jan 05, 2017 9:01 am
by yellowled
You can also use the aforementioned serendipity_event_page_nugget plugin. It has a option to insert code at the end of the page, which is usually recdedommen for counter snippets like this one, and I believe you can install multiple instances of it. So if you wanted to use it for extra footer markup and this Google Analytics snippet, you don't have to put both of them in the same page nugget.

YL