Hello,
i´m still exploring piwigo and its working fine for me, except the following damn issue i cant solve on my own since 2h. I want to use Google Analytics to track my visitors and therefor i need to paste a javascript code into every page of my Piwigo Gallery. I thought of pasting it into the footer or header so it should work fine also?
I also tried out the extension for google analytics code, but its not working! After activating it in admin plugin menu, i get this error message: "Parse error: syntax error, unexpected T_EXIT in /users/my_username_of_webspace/www/plugins/Statistics/admin/stat_admin.php on line 1". So i want to get this solved manually to just get it working!
Does anyknow know: How and Where I have to insert my code to get this thing working? :-/
Google Analytics Code:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-XXXXXXX-X");
pageTracker._trackPageview();
} catch(err) {}</script>
Best Regards,
Joe
Hello,
i just modifidied the old stat_admin.php uploaded than got a screen "Hacking attemt!" then i modified it back to original, uploaded it and voila its working! *,* I got no idea what or where there was the issue, but anyways its working now.
Sorry for this topic and double post, but i was unable to delete it. :S
- Joe
Offline
i am also having some kind of similar problem,
i am using plugin Statistic. when i insert the code into the header, my page really gets messed up,
when i try putting in footer , it doesnt work. i cant see the code from view source
any clue
Offline
If you already understood the template extensions logic, make a in a new copy of footer.tpl
add:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=\'" + gaJsHost + "google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2xxxxxxx-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
Associate the new template to the default footer.tpl
And that's it!
Enjoy!
See Smarty documentaion, for more.
And some additional function are avaliable like
{known_script id="jquery.ui.sortable" src=$ROOT_URL|@cat:"template-common/lib/ui/ui.sortable.packed.js" } if you yan the library being described once.
Offline
Sorry if I insert google code in footer.tpl have:
Fatal error: Smarty error: [in footer.tpl line 37]: syntax error: unrecognized tag 'var' (Smarty_Compiler.class.php, line 590)
Offline
Did you use [extension by sakkhho] Statistics?
Have you checked the code generated in the source of your page? I saw a couple of times a copy/paste that didn't work properly, and part of the code was lost.
If possible, give us a link (by MP if you prefer).
Offline
MP received.
[extension by sakkhho] Statistics was installed manually (the provider doesn't allow the automatic installation) and didn't work; Piwigo crashes when clicking on the Statistics plugin link.
Offline
Hi,
my provider fixed error and I installed this plugins with admin panel, then I copy and paste Analytics code. But if I view html code in piwigo home page not view Analytics code.
In admin panel if I manage statistic plugin, I view incomplete Analytics code.
Last edited by Ericnet (2010-06-19 21:54:05)
Offline
Hi,
Statistics plugin doesn't work for me, it "eats" the bottom part of my stats code (piwik) : I put the code and check the footer / header case, the code doesn't appear in the page after reload, and if I go to another admin page and come back to Statistics admin page, the last part of the code is then missing ...
→ I now use a footer.tpl extension, but to avoid smarty error the stats code must be put inside {literal} ... {/literal}
Offline
saimon wrote:
but to avoid smarty error the stats code must be put inside {literal} ... {/literal}
Shouldn't the plugin be fixed so the webmaster don't have to add {literal} ... {/literal} ?
Offline
the issue here is that Google has two types of code - html and php. the html version gives the errors described above. I inserted the php variant of the google analytics code, and all runs perfectly (statistics plug in and all).
Helpful - here is the dynamic (good for php and Piwigo) google analytics code to insert into the footer before the </body> tag:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
</script> <?php
// End Analytics tracking code
?>
(the standard (i.e. html) google analytics code gave me a php error, but the (php) code above works perfectly)
To insert the code into the footer, follow tehse instructions (given in another thread by LucMorizur):
"
However to change the footer, use LocalFiles Editor (Admin > Specials > Plugins), to create a my_footer.tpl template file based on footer.tpl for the template you use. To apply the file you created, you go to Admin > Configuration > Templates, and there you activate the file you created (which is listed here once you saved it) to replace footer.tpl.
"
Offline
tosca wrote:
saimon wrote:
but to avoid smarty error the stats code must be put inside {literal} ... {/literal}
Shouldn't the plugin be fixed so the webmaster don't have to add {literal} ... {/literal} ?
Smarty 3 (still in Release Candidate) will offer a new property 'auto_literal'.
By default '{ ' and ' }' with spaces will be interpreted as literal, and no longer as Smarty delimiter.
;-)
Offline
rarebit_, please try:
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
</script>
Offline
VDigital wrote:
tosca wrote:
saimon wrote:
but to avoid smarty error the stats code must be put inside {literal} ... {/literal}
Shouldn't the plugin be fixed so the webmaster don't have to add {literal} ... {/literal} ?
Smarty 3 (still in Release Candidate) will offer ...
The purpose of my remark was to say that the webmaster should not have to be bothered with 'something' to add/modify/suppress in order to comply with Smarty requirements.
He/she should have only to copy/paste the code provided by Google or any other statistics script provider, the plugin itself taking care of whatever Smarty will need in order to 'swallow the foreign code'.
My own 0.02 ;-)
Offline