hidden codes and a theme

Skinning and designing Serendipity (CSS, HTML, Smarty)
Post Reply
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

hidden codes and a theme

Post 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
Don Chambers
Regular
Posts: 3652
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Re: hidden codes and a theme

Post by Don Chambers »

You can do that with the event plugin HTML-Code inside head (HTML-Head Nugget).
=Don=
Imajica
Regular
Posts: 59
Joined: Mon Dec 05, 2016 5:26 pm
Location: Racine
Contact:

Re: hidden codes and a theme

Post by Imajica »

awesome
Thank you

I just love this framework
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: hidden codes and a theme

Post 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
Post Reply