Author Topic: Google Analytics in Settings  (Read 3865 times)

Offline scheltel

  • Posts: 48
Google Analytics in Settings
« on: August 06, 2011, 12:08:14 AM »
I want to extend the settings form to enter the Google Analytics String.

I have modified the code, but when I'm trying to save the settings,  the script tags are not submitted to the database. It seems that there anti-cross site scripting measurements are taken. Is this true? And if so, how can I bypass this behavior?


[gelöscht durch Administrator]

Offline badknight

  • WebsiteBaker Org e.V.
  • **
  • Posts: 819
  • Gender: Male
    • pinzweb
Re: Google Analytics in Settings
« Reply #1 on: August 06, 2011, 09:46:32 AM »
show us the changes from the save.php you made for this.. maybe ther is something wrong
Ich würde gern die Welt verändern, doch Gott gibt mir den Quellcode nicht...

Offline scheltel

  • Posts: 48
Re: Google Analytics in Settings
« Reply #2 on: August 06, 2011, 11:19:17 AM »
I did not make any changes in save.php.

I have added the following 2 lines to /admin/settings/index.php

   $template->set_var(array(
                        [.... standard coding v2.8.2 ...]                        'HEADING_GOOGLE_ANAL YTICS_SETTINGS' => $HEADING['GOOGLE_ANALYTICS_SE TTINGS']                        
                        )
                  );

   // Insert language text and messages
   $template->set_var(array(
                        [.... standard coding v2.8.2 ...]
                        'TEXT_GOOGLE_ANALYTI CS_DESCRIPTION' => $TEXT['GOOGLE_ANALYTICS_DE SCRIPTION']
                        ));

Added to /templates/wb_theme/templates/settings.htt

<tr>
   <td colspan="3" style="padding-top: 10px;">
      <h2>{HEADING_GOOGLE_ANALYTICS_SETTINGS}</h2>
   </td>
</tr>
<tr>
   <td class="setting_name">{TEXT_GOOGLE_ANALYTICS_DESCRIPTION}</td>
   <td class="setting_value" colspan="2">
      <textarea name="google_analytics">{GOOGLE_ANALYTICS}</textarea>
   </td>
</tr>
<tr>
   <td>&nbsp;</td>
   <td>
      <input type="submit" name="submit" value="{TEXT_SAVE}" class="save" />
      <input type="reset" name="reset" value="{TEXT_RESET}" class="reset" />
   </td>
</tr>


Added to /install/save.php

   $settings_rows=   "INSERT INTO `".TABLE_PREFIX."settings` "
   ." (name, value) VALUES "
[.... standard coding v2.8.2 ...]
   ." ('google_analytics', '')";
   $database->query($settings_rows);


Added to /languages/[language].php
$TEXT['GOOGLE_ANALYTICS_DE SCRIPTION'] = 'Google Analytics String';
$HEADING['GOOGLE_ANALYTICS_SE TTINGS'] = 'Google Analytics Settings';


Added to /templates/[TEMPLATE_NAME]/index.php

if (function_exists('get_google_analytic s')) { get_google_analytic s(); }
?>
</body>


See attachment...

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3043
  • Gender: Female
Re: Google Analytics in Settings
« Reply #3 on: August 06, 2011, 11:33:29 AM »
go into /admin/settings/save.php and search for the Line:

Code: (/admin/settings/save.php) [Select]
<?php

139   $allow_tags_in_fields 
= array(&#39;website_header&#39;, &#39;website_footer&#39;);

?>

and add your new datafield to this array.

thats all


take care:
Google Analytics is a very hot iron. Especially in Germany and partly in other EU countries also, you can easily come in conflict with the privacy act and other law. Unawareness does not protect against punishment. That's why we do not include such 'features'.
« Last Edit: August 06, 2011, 11:50:45 AM by DarkViper »
Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !

Offline scheltel

  • Posts: 48
Re: Google Analytics in Settings
« Reply #4 on: August 06, 2011, 12:34:57 PM »
DarkViper thanks!

So Google Analytics will not be built-in in future releases?

Offline DarkViper

  • Forum administrator
  • *****
  • Posts: 3043
  • Gender: Female
Re: Google Analytics in Settings
« Reply #5 on: August 06, 2011, 01:25:33 PM »
Definitely not.
Website Baker is used by a big amount of people who do not know many/all of the legal regulations. It would be careless of us to offer them options that they can bring into conflict with the law.

If somebody like to use GA anyway, so it's very easy to implement it in the index.php of each template.

Der blaue Planet - er ist nicht unser Eigentum - wir haben ihn nur von unseren Nachkommen geliehen

"You have to take the men as they are… but you can not leave them like that !" :-P
Das tägliche Stoßgebet: Oh Herr, wirf Hirn vom Himmel !