hidden codes and a theme

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

hidden codes and a theme

Post by Imajica » Wed Jan 04, 2017 4:04 pm

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

User avatar
Don Chambers
Regular
Posts: 3633
Joined: Mon Feb 13, 2006 3:40 am
Location: Chicago, IL, USA
Contact:

Re: hidden codes and a theme

Post by Don Chambers » Wed Jan 04, 2017 6:00 pm

You can do that with the event plugin HTML-Code inside head (HTML-Head Nugget).

Imajica
Regular
Posts: 55
Joined: Mon Dec 05, 2016 6:26 pm
Location: Racine
Contact:

Re: hidden codes and a theme

Post by Imajica » Wed Jan 04, 2017 6:55 pm

awesome
Thank you

I just love this framework

User avatar
yellowled
Regular
Posts: 7002
Joined: Fri Jan 13, 2006 12:46 pm
Location: Eutin, Germany
Contact:

Re: hidden codes and a theme

Post by yellowled » Thu Jan 05, 2017 10:01 am

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
amazon Wishlist - Serendipity-Podcast (German only, sorry)

Post Reply