View Full Version : StatCounter code makes page "jump"
peterfrem
07-06-2005, 07:16 PM
Hello
When i place the statcounter code right after the opening <body> tag, the page "jumps" when it loads as if there was something that was supposed to be rendered but then disappears. Also, after the jump, there appears to be a space or line break that is nowhere in the code but appears when viewed in a browser.
Let's say the first line of code after the <body> tag is a <table> tag and the statcounter code is in between both. When the page is rendered, it looks as though the code is making a space in the browser, even though it's invisible.
What can be done?
Thanks.
webado
07-06-2005, 08:06 PM
Move the counter outside of any table cell. Best put it at the bottom of the page, just before the </body> tag.
What you see as "jumping" is the alt tag of the image just before the server returns it. Nothing at that point is aware that it's suppsoed to be invisible yet.
You can also combine the 2 kinds of invisible counter settings: a counetr configured as invisible combined with counter code geenrated also as invisible.
In order to gate that counter code, yur counter has to first be configure as visible, then you generate the code as invisible and copy that code and use it on yuor pages. Then go back and configure the counter as invisible.
Basically what will end up changed is the addition of var sc_invisible=1; to the first javascript and &invisible to the query string on the <img ... > tag in the <noscript> ... </noscript> portion of the code.
paulzon
07-15-2005, 04:58 PM
Move the counter outside of any table cell. Best put it at the bottom of the page, just before the </body> tag.
... or you could fix the height of the table / cell your counter is within eg <TD height=50>.
Paul (www.zonicweb.net)
webado
07-15-2005, 05:42 PM
It's not so much the height, but the width. The alt tag that you get with the counter script when it's not set to invisible in the generated code may be wider than the space alloted. The javascript portion gets executed first before the configureed settings of the counter are known, so the alt tag is present even if the counter itself is configured to be an invisible image.
The slight delay in accessing the server where the counter project is defined may mean that on a slower conneciton you get to see briefly that alt tag, with the associated distortion.
paulzon
07-15-2005, 07:55 PM
It's not so much the height, but the width.
Well it could be either, or both, depending on the table (mine jumps with the height) but good point Christina, I should have mentioned both.
Now I may be arrested by the Statcounter police for writing such heresy, but you can always cut the "ALT" text as well, as it does not affect functionality (despite what they write).
Paul (www.zonicweb.net)
webado
07-15-2005, 11:19 PM
But that's not the one that causes the "jump". The one you see in the inserted code is for the <noscript> segment, which only comes into play for non-javascript enabled browsers.
The one that causes the "jump" comes from the scripts at Statcounter.
By using code for invisible counter AND a counter configured as invisible you avoid all this. No dice if you need a visible counter. The only fully safe solution then is to place it completely at the bottom of the page, outside any table and so that it's last to load.
vBulletin® v3.8.5, Copyright ©2000-2013, Jelsoft Enterprises Ltd.