Statcounter Integration and Default Font Size Change Issue

Started by mggevo, November 17, 2016, 11:58:07 AM

Previous topic - Next topic

mggevo

Greetings,
Trying to add Statcounter to SMF 2.0.12 default theme and having an index.css issue.
Script is a text/javascript where placing the code at the absolute bottom of the index.template.php of the default theme causing forum font size to change.
Other than that everything works fine.
Any help is much appreciated.
Thank you.

Illori

are you putting it before or after the closing php tag?

mggevo

It is after the closing tag. Attached the end section of the code below.



// No buttons? No button strip either.
if (empty($buttons))
return;

// Make the last one, as easy as possible.
$buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);

echo '
<div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
<ul>',
implode('', $buttons), '
</ul>
</div>';
}

?>
<!-- Start of StatCounter Code for Default Guide -->
<script type="text/javascript">
var sc_project=111xxxxx;
var sc_invisible=1;
var sc_security="aa0xxxxx";
var scJsHost = (("https:" == document.location.protocol) ?
"https://secure." : "http://www.");
document.write("<sc"+"ript type='text/javascript' src='" +
scJsHost+
"statcounter.com/counter/counter.js'></"+"script>");
</script>
<noscript><div class="statcounter"><a title="shopify site
analytics" href="http://statcounter.com/shopify/"
target="_blank"><img class="statcounter"
src="//c.statcounter.com/111xxxxx/0/aa0xxxxx/1/"
alt="shopify site analytics"></a></div></noscript>
<!-- End of StatCounter Code for Default Guide -->

Illori

Put it before and try again. Be sure to put it in an echo statement or check the mod site and see if there is a mod you can install.

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

mggevo

Quote from: Illori on November 17, 2016, 01:02:53 PM
Put it before and try again. Be sure to put it in an echo statement or check the mod site and see if there is a mod you can install.

Mod is removed from the forum and I have tried it above the tag with echo and I am getting

Template Parse Error!

There was a problem loading the /Themes/default/index.template.php template or language file. Please check the syntax and try again - remember, single quotes (') often have to be escaped with a slash (\). To see more specific error information from PHP, try accessing the file directly.

You may want to try to refresh this page or use the default theme.


Quote from: Kindred on November 17, 2016, 01:25:58 PM
basically, you can not just randomly add code.

This is what is provided at Statcounter for SMF :/

Is there a way I can add some code to the default theme Index.css to fix this?

Illori


coachcomeback

Quote from: mggevo on November 17, 2016, 11:58:07 AM
Greetings,
Trying to add Statcounter to SMF 2.0.12 default theme and having an index.css issue.
Script is a text/javascript where placing the code at the absolute bottom of the index.template.php of the default theme causing forum font size to change.
Other than that everything works fine.
Any help is much appreciated.
Thank you.

I know this is old, but a google search brought me here because I was having the same problem. And it seems no one answered correctly. After digging all over searching for the Header or footer files to add the "statcounter" code like the instructions say, I ended up finding a mod that made it easy. I just had to copy and paste it in and it worked like a charm. Saved lots of trouble and no screwing around with editing code.

here is the mod I used. Hope this helps anyone in the future http://custom.simplemachines.org/mods/?mod=351

Advertisement: