Script produces black stripe
agrigor1 - January 24, 2009 - 02:32
| Project: | Piwik - Web analytics |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
The script added at the footer produces a black stripe.
The script is created by theme at the footer by calling
<?php print $closure; ?>
The script created is the following
script type="text/javascript">
<!--//--><![CDATA[//><!--
try{piwik_action_name = document.title;piwik_site_id = "1";piwik_url = pkBaseURL + "/piwik.php";piwik_download_extensions = "7z|aac|avi|csv|doc|exe|flv|gif|gz|jpe?g|js|mp(3|4|e?g)|mov|pdf|phps|png|ppt|rar|sit|tar|torrent|txt|wma|wmv|xls|xml|zip";piwik_vars = "";piwik_log(piwik_action_name, piwik_site_id, piwik_url, piwik_vars);} catch(err) {}
//--><!]]>
</script>so i guess that the 'try' call or the 'catch' function return something that shouldn't be displayed as stripe on screen destroying the page layout.
How can I achive this?
Another question has to do with the option of putting the script on header. Selecting this option has no effect (after cleaning the caches). Is this a problem of the theme I use or this option doesnt really work?
I tried this option in order to see what happens if we have the script on header, but the script remains on footer after cleaning cache.

#1
The try and catch is only to catch possible JS script errors if browser extensions (adware/tracker blocker) are going to block your piwik.js file. This have been seen in the GA project version often... So I added it here, too. Normaly - it does nothing.
Additional I don't know why this JS code should ever add a black stripe. This must be theme related. Try to debug with Firebug or so.
#2
I dont think its theme related. I belive those calls return a value. Perhaps this value is NULL which is being displayed by php print. Why dont you test this in script? I cant do it because I am not an experienced programmer and I dont know javascript (only some php).
You might also have a look at the other issue I refferred to you. This is the placement of script at header. Are you sure this works?
Usually themes dont use
<?php print $closure ?>at header.They usually use
<?php print $head; ?>
<?php print $styles; ?>
<?php print $scripts; ?>
So I guess you should have the piwik script added at $scripts variable.
Correct me If I am wrong (I dont pretend to be a specialist anyway).
Thank you
#3
<?php print $closure ?>need to be in the bottom of a page - before</body>. All is working for me. Try to repro your issue with garland.#4
This is exactly the place where the strip is produced. Before the body closing.
But If place the print $closure a little above, under the beginning of div footer section then there seems to be no problem. Thats what I did to overcome the issue.
The print $closure was after the closing of div footer and before the body closing tag.
#5
If you would use Firebug you can see what CSS value is set and cause this issue.
#6
Automatically closed -- issue fixed for 2 weeks with no activity.