Syntax error using Statcounter in Blogsome (Wordpress)

Status
Not open for further replies.
#1
Hi,

if I use the generated Statcounter code in my Blogsome page

http://animetv.blogsome.com

then the following is displayed if I open the webpage in my browser.

File index.html, line 137: syntax error:
unrecognized tag: if(sc_https==1) { sc_doc_loc = ''+document.location; myRE = new RegExp("^https", "i") if(sc_doc_loc.match(myRE)) { sc_http_url = "https";


What is the problem?

I have seen other Blogsome sites using Statcounter and they seem to have no problems.
 
#3
Yeah, I deleted it, because the only thing the page shows is the error-message if I use the Statcounter code in the Blogsome-Template.

I used many variants of the code, but it is always the same and the blog only shows the error-message if I use the Statcounter code.
 
#4
Cannot help you in that case, sorry.

We have to see the real page with the code on it to figure out what the problem is. Theory doesn't help.
 
#5
Ok, the Statcounter code is in use again, but you cannot see the source-code on the page.

http://animetv.blogsome.com


So here is the source for the page and the error-message can be seen if you go to the site.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<title>{bloginfo show='name'} {single_post_title prefix=' :: '}{single_cat_title prefix=' :: '}{single_month_title prefix=' :: '}</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="imagetoolbar" content="no" />
<meta content="TRUE" name="MSSmartTagsPreventParsing" />
<meta name="generator" content="WordPress {$wp_version}" /><!-- leave this for stats -->
<style type="text/css" media="screen">
@import url( "{$siteurl}/templates/wp-layout.css" );
</style>
<link rel="alternate" type="text/xml" title="RDF" href="{bloginfo show='rdf_url'}" />
<link rel="alternate" type="text/xml" title="RSS" href="{bloginfo show='rss2_url'}" />
<link rel="alternate" type="text/xml" title="Atom" href="{bloginfo show='atom_url'}" />
{capture name=pingback}{bloginfo show='pingback_url'}{/capture}
{if $smarty.capture.pingback != ""}
<link rel="pingback" href="{$smarty.capture.pingback}" />
{/if}

</head>
<body>
{comments_popup_script}
{insert name="getreferer"}
<body>
<div id="rap">
<div id="header">
<h1>
<a href="{$siteurl}" title="{bloginfo show='name'}">{bloginfo show='name'}</a></h1></div>

<div id="content">
{$content}
</div>

<div id="menu">
Links:
<ul>
{get_links category='-1' before='<li>' after='</li>' between='' show_images='0' orderby='_updated' show_description='0' show_rating='0' limit='-1' show_updated='-1'}
</ul>

Categories:
<ul>
{list_cats optionall='0' all='All' sort_column='name'}
</ul>

Search: </h2><form id="searchform" method="POST" action="/">
<div><input type="text" name="s" size="15" /><br />
<input type="submit" name="submit" value="search" />
</div></form>
</li></ul>

Archives:
<ul>
{get_archives type='monthly'}
</ul>

<ul><li>
{get_calendar}
</li></ul>

{lastposts posts='20'}
{if $lastposts != ''}
<h2>Most Recent Posts</h2>
<ul>
{foreach from=$lastposts key=id item=title}
<li><a href="{get_permalink id=$id}" title="{$title}">{$title|truncate:20:"..."}</a></li>
{/foreach}
</ul>
</li></ul>
{/if}

{todayayearago when='month'}
{if $todayayearago != ''}
<ul><li>A Month Ago
<ul>
{foreach from=$todayayearago key=id item=details}
<li><a href="{get_permalink id=$id}" title="{$details.content|truncate:20:"..."}">{$details.title|truncate:20:"..."}</a></li>
{/foreach}
</ul>
</li></ul>
{/if}

{popularposts}
{if $pposts != ''}
<h2>Most Popular Posts</h2>
<ul>
{foreach from=$pposts key=key item=hits}
<li><a href="{$hits.url|escape}" title="{$hits.title}">{$hits.title|truncate:30:"..."}</a>: {$key}</li>
{/foreach}
</ul>
{/if}

<h2>Other:</h2>
<ul>
<li><a href="{$siteurl}/wp-login.php">login</a></li>
<li><a href="{$siteurl}/wp-register.php">register</a></li>
</ul>

<h2>Meta:</h2>
<ul>
<li><a href="{bloginfo show='rss_url'}">RSS .92</a></li>
<li><a href="{bloginfo show='rdf_url'}">RDF 1.0</a></li>
<li><a href="{bloginfo show='rss2_url'}">RSS 2.0</a></li>
<li><a href="{bloginfo show='atom_url'}">Atom</a></li>
<li><a href="{bloginfo show='comments_rss2_url'}">Comments RSS 2.0</a></li>
<li><a href="http://validator.w3.org/check/referer" title="This page validates as XHTML 1.0 Transitional">Valid <abbr title="eXtensible HyperText Markup Language">XHTML</abbr></a></li>
</ul>


<!--
####################################################
#### Do Not Remove ####
-->
<ul><li><ul><br />
<script type="text/javascript"><!--
{$advertisement}
google_color_border = "DFD8DF";
google_color_bg = "FFFFFF";
google_color_link = "909790";
google_color_url = "909790";
google_color_text = "000000";
//--></script>
{$advertisement_image_block}
</ul></li></ul>
<!--
#### Do Not Remove ####
####################################################
-->


</div>
</div>
<!--
####################################################
#### Do Not Remove ####
-->
<p id="footer">{$georgia2}</p>
<!--
#### Do Not Remove ####
####################################################
-->

</div>


<!-- Start of StatCounter Code -->
<script type="text/javascript" language="javascript">
<!--
var sc_project=2412363;
var sc_invisible=0;
var sc_partition=22;
var sc_security="f7725520";
//-->
</script>

<script type="text/javascript" language="javascript" oldSrc="http://www.statcounter.com/counter/counter.js" NG="replaced">
//<!--
var sc_width=screen.width;
var sc_referer = ""+document.referrer;
// var sc_referer = parent.document.referrer;
var sc_title = "";
var sc_url = "";
var sc_unique = 0;
var sc_returning = 0;
var sc_returns = 0;
var sc_agent = navigator.appName+' '+navigator.appVersion;
var sc_base_dir;
var sc_error=0;
var sc_remove=0;
var sc_http_url="http";
var sc_link_back_start = "";
var sc_link_back_end = "";
var sc_security_code = "";


if(window.sc_https) {
if(sc_https==1) {
sc_doc_loc = ''+document.location;
myRE = new RegExp("^https", "i")
if(sc_doc_loc.match(myRE)) {
sc_http_url = "https";
}
else {
sc_http_url = "http";
}
}
else
sc_http_url = "http";
}


if(window.sc_partition) {
var sc_counter = sc_partition+1;
sc_base_dir = sc_http_url+"://c"+sc_counter+".statcounter.com/";
}
else {
sc_base_dir = sc_http_url+"://c1.statcounter.com/";
var sc_partition=0;
}

if(window.sc_text)
sc_base_dir += "text.php?";
else
sc_base_dir += "t.php?";

if(window.sc_project) {
sc_base_dir += "sc_project="+sc_project;
if((sc_project==1395484)||(sc_project==1395532)||(sc_project==1300900)||(sc_project==1420550)||(sc_project==1301977)||(sc_project==1299576)||(sc_project==1286300))
sc_remove=1;
}
else if(window.usr) {
sc_base_dir += "usr="+usr;
}
else {
sc_error = 1;
}

if(window.sc_remove_link) {
sc_link_back_start = "";
sc_link_back_end = "";
}
else {
sc_link_back_start = "<a href=\"http://www.StatCounter.com\" target=\"_blank\">";
sc_link_back_end = "<\/a>";
}

sc_date = new Date();
sc_time = sc_date.getTime();
sc_agent = sc_agent.toUpperCase();

sc_time_difference = 60*60*1000;

sc_title = ""+document.title;
sc_url = ""+document.location;
sc_referer = sc_referer.substring(0, 150);
sc_title = sc_title.substring(0, 150);
sc_url = sc_url.substring(0, 150);
sc_referer = escape(sc_referer);
sc_title = escape(sc_title);
sc_url = escape(sc_url);

if (window.sc_security) {
sc_security_code = sc_security;
}

var sc_tracking_url = sc_base_dir+"&resolution="+sc_width+"&camefrom="+sc_referer+"&u="+sc_url+"&t="+sc_title+"&java=1&security="+sc_security_code+"&sc_random="+Math.random();

// if no usr or project set then display visibile

// if usr=="someuser" then display visibile

if(sc_error==1) {
document.writeln("Code corrupted. Insert fresh copy.");
}
else if(sc_remove==1) {
document.writeln("<b>StatCounter cannot track a high volume website like yours for free. This was stated several times during the sign up process. Please remove the code ASAP.</"+"b>");
}
//else if(sc_partition==6) {
// down at the moment
//}
else if (window.sc_invisible) {
if(window.sc_invisible==1) {
sc_img = new Image();
sc_img.src = sc_tracking_url;
}
else {
document.writeln(sc_link_back_start+"<IMG SRC=\""+sc_tracking_url+"\" ALT=\"StatCounter - Free Web Tracker and Counter\" BORDER=\"0\">"+sc_link_back_end);
}
}
else if (window.sc_text) {
document.writeln('<scr' + 'ipt language="JavaScript"' + ' src=' + sc_tracking_url+"&text=" + sc_text+ '></'+'scr' + 'ipt>');
}
else {
document.writeln(sc_link_back_start+"<IMG SRC=\""+sc_tracking_url+"\" ALT=\"StatCounter - Free Web Tracker and Counter\" BORDER=\"0\">"+sc_link_back_end);
}


//--></script><noscript><a href="http://www.statcounter.com/" target="_blank"><img src="http://172.28.21.132/c23.statcounter.comm/counter.php?sc_project=2412363&java=0&security=f7725520&invisible=0" alt="counter statistics" border="0"></a> </noscript>
<!-- End of StatCounter Code -->


</body>
</html>
 
#6
What you think you did doesn't help. It's obvious you have not added the code correctly using the tools available on that site, and have no broken your page.

You will have to refer to the help on that site to find how to add custom html code.

I cannot help you with how to use that site's tools, sorry.
 
#7
You ended up adding the contents of the Statcounter script which you are supposed to have as an external script.

You should not do that.


The code given by Statcounter contains:

<script type="text/javscript" src="http://www.statcounter.com/counter/counter.js"</script>


But you actually went and got the contents of counter.js and put it there.

Maybe your application does not allow you to use remotely hosted javscript. In that case you may only be able to use the html-only version of the code.
 
Status
Not open for further replies.
Top