If you have a question for us at Piwik that has not been answered before, feel free to flick us an email at hello@piwik.org and we shall pop the answer up here for all to see. Thanks!
<a href='http://linkedin.com'>LinkedIn Profile</a>
If you wish to not track clicks on your subdomains as outlinks, for example if your website is "example.org/" and you don't want to track outlinks to "news.example.org", you can use the Javascript function setDomains(). Read more in the documentation.
Learn more about Click Tracking in the Javascript tagging Guide. AddHandler php5-cgi .phpSetEnv PHP_VER 5AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php[General]
assume_secure_protocol = 1
If you install Piwik from behind the reverse proxy (where Piwik can't detect https will be used), you should set the above manually.
Also, depending on your proxy server, the Visitor IP is set in a different HTTP Header which should also be automatically detected on install and added to your config/config.ini.php:
[General]
; CloudFlare proxy
; proxy_client_headers[] = HTTP_CF_CONNECTING_IP
; ISP proxy (Client-IP)
;proxy_client_headers[] = HTTP_CLIENT_IP
; standard proxy
;proxy_client_headers[] = HTTP_X_FORWARDED_FOR
;proxy_host_headers[] = HTTP_X_FORWARDED_HOST
If Piwik was unable to detect your proxy configuration, please add these lines manually in your Piwik config file.
If your server is configured behind an outgoing proxy, check out this FAQ: outgoing Proxy easy setup in Piwik.
You might also be interested in How do I force Piwik login to use SSL (https)?. session_save_handler = dbtable
Caveat: if you have many concurrent dashboard users, you may need to increase the max number of client connections to the database server.
Error trying to execute the query 'CREATE TABLE [...] Base table or view already exists: 1050 Table exists or SQLSTATE[42S22]: Column not found: 1054 Unknown column on clause or SQLSTATE[42000]: Syntax error or access violation: 1091 Can't DROP X check that column/key exist or Error trying to execute the query 'ALTER TABLE' SQLSTATE[42S22]: Column not found: 1054 Unknown column
The good news is that it possible in all cases to resolve the issue and not experience any data loss or other problem!
You can manually tell Piwik to run the upgrade again from the version you last good version, by running the following SQL query (eg. using a tool such as phpMyAdmin):
UPDATE `piwik_option` SET option_value = "1.X" WHERE option_name = "version_core";
Replace 1.X with the version you were using prior to upgrading, for example "1.10". After running this query, visit Piwik: you should see the upgrade screen again. You can run the upgrade in the command line if your Piwik is large, or simply click the button and wait until completion.
If you still have problems, you can get help in the forums or contact Professional Services for paid support by us.
piwikTracker.setDocumentTitle("ajax/click view button");
piwikTracker.trackPageView();
You can also customize the delimiter to use for splitting your page URLs and Page titles into categories (or disable the feature by setting the delimiter to a character not in use in your Page titles). Edit your config/config.ini.php file, and set the following:
[General]
action_title_category_delimiter = ::
You can then define your custom page names as follows: piwikTracker.setDocumentTitle("Products :: Gardening :: Seeds id=123"); and your pages and categories will be grouped according to the :: delimiter. [General]
; maximum number of rows for any of the Referers tables (keywords, search engines, campaigns, etc.), and Custom variables names
datatable_archiving_maximum_rows_referers = 5000
; maximum number of rows for any of the Referers subtable (search engines by keyword, keyword by campaign, etc.), and Custom variables values
datatable_archiving_maximum_rows_subtable_referers = 5000
; maximum number of rows for any of the Actions tables (pages, downloads, outlinks)
datatable_archiving_maximum_rows_actions = 5000
; maximum number of rows for pages in categories (sub pages, when clicking on the + for a page category)
datatable_archiving_maximum_rows_subtable_actions = 5000
[Debug]
always_archive_data_day=1 to force archiving of the daily reports, and/or [Debug]
always_archive_data_period=1 to force archiving for all period reports (week, month, year). If you then visit the Piwik UI for a given date, reports will be re-processed. When you are done, do not forget to set these values back to 0
[Debug]
always_archive_data_day=0
always_archive_data_period=0
[General] section:
[General]
force_ssl=1
_paq.push(['setDocumentTitle', '404/URL = '+String(document.location.pathname+document.location.search).replace(/\//g,"%2f") + '/From = ' + String(document.referrer).replace(/\//g,"%2f")]);
before the line _paq.push(['trackPageView']);
[Tracker]
trust_visitors_cookies = 1
This will ensure that even if all visitors have the same IP, browser configuration, OS, etc. they will be counted as unique visitors based on the first party cookies. If not set, you will see a lower number of visits.
/pathpiwik/index.php?module=Login&action=logme&login=your_login&password=your_MD5_password
This will log the user (create a cookie in their browser) and redirect to the index.php on succesful login. We advise to do this authentication over HTTPS. Note that this authentication method doesn't work for the Super User.
You can also specify the URL to redirect after a successful login, if different from the default Piwik dashboard page:
/pathpiwik/index.php?module=Login&action=logme&login=your_login&password=your_MD5_pwd&url=http://piwik.mycompany.com/subpath/
You can also specify an idSite (website ID) to load by default after the redirect:
/pathpiwik/index.php?module=Login&action=logme&login=your_login&password=your_MD5_pwd&idSite=145
[General]
enable_framed_pages = 1
Instead of loading the login screen in an iframe, you might want to use the logme() method to automatically log your users in Piwik remotely. login_logout_url="http://example.org/page"When the user logs out, he will be redirected to this URL instead.
DROP TABLE piwik_archive_numeric_2011_01, piwik_archive_numeric_XX; They will automatically be re-created from the Visitor logs when Piwik processes your reports.DELETE FROM piwik_log_visit WHERE idsite = X;
DELETE FROM piwik_log_link_visit_action WHERE idsite = X;
DELETE FROM piwik_log_conversion WHERE idsite = X;
DELETE FROM piwik_log_conversion_item WHERE idsite = X; with X replaced by the website ID you wish to reset. _paq.push(['trackPageView']); by if (!window.location.pathname.match(/^/(admin|login)//))
{
_paq.push(['trackPageView']);
}
In this example, all URLs except the ones containing "/admin/" or "/login/" will be tracked by Piwik. &period=range&date=2011-02-15,2011-02-25 [General] section, the following line:
noreply_email_address = "info@example.org"
All reports by email will now be sent from "info@example.org" _paq.push(['setCustomUrl', location.href.toLowerCase()]);
just before the line:
_paq.push(['trackPageView']);
All your pages will now be tracked as lowercase, eg. "Default.aspx" or "DEFAULT.aspx" will be tracked as "default.aspx". Until Oct 2012, Piwik was relying on Feedburner and the 'Awareness API' to provide RSS. It used to provide the following information:
Unfortunately, Feedburner now owned by Google decided to shut down permanently their API. We are now considering doing Feed Analytics using Piwik. We are looking for supporters & funding to build a simple script that will track RSS & atom feeds usage! If you would like to help fund this feature, please get in touch with the core team or post a comment on this ticket.
[Tracker]
record_statistics = 0
This will cause all Piwik Tracking requests to return quickly the 1*1 gif beacon, without connecting to the Database or doing any processing.
[General]
maintenance_mode = 1
When maintenance_mode is on, the API is also disabled. For example, the XML message returned is:
<?xml version="1.0" encoding="utf-8" ?> <result><error message="Piwik is in scheduled maintenance. Please come back later." /></result>
[General]
enable_processing_unique_visitors_day = 1
enable_processing_unique_visitors_week = 1
enable_processing_unique_visitors_month = 1
enable_processing_unique_visitors_year = 0
enable_processing_unique_visitors_range = 0
By default, unique visitors are processed for days, weeks and months (they are set to 1). You can for example enable yearly unique visitors by setting enable_processing_unique_visitors_year = 1
Note: processing the Unique Visitors metrics is using the Piwik logs. This requires that the feature "Delete old logs" is not used on your Piwik server. [Tracker]
use_third_party_id_cookie = 1
When this is enabled, Piwik tracker will serve a third party cookie containing an id visitor (16 chars ID). This ID will be the same for this visitor across all websites, and is stored in the database field "idvisitor". _paq.push(['setCampaignNameKey', 'campaign']);
_paq.push(['setCampaignKeywordKey', 'keyword']);
Note: these two functions also accept an array of strings. If an array of names is specified, the first non empty campaign or keyword parameter value will be selected.
[Tracker]
campaign_var_name="campaign"
campaign_keyword_var_name="keyword"
Note: you may specify a comma separated list of campaign parameter names, in case you wanted Piwik to read the campaig name or value from several possible parameters. The first non empty value will be used.
SELECT inet_ntoa(conv(hex(location_ip), 16, 10)) as ip, conv(hex(idvisitor), 16, 10) as visitorId FROM piwik_log_visit; ?module=API&method=CoreAdminHome.invalidateArchivedReports&idSites=1,3,5&dates=2012-01-01,2011-10-15&token_auth=xyzThe next time auto archiving will run will automatically re-process the data for these particular dates.
[Tracker]
window_look_back_for_visitor = 2592000
Note that by default, Piwik looks only in the past 30 minutes. We do this for performance reasons: to keep Piwik tracking fast, even if you track hundreds of thousands or millions of unique visitors per month). [Tracker]
new_visit_api_requires_admin=0
Then in your website, in Javascript, whenever a user logs in the system (or whenever there is a need to create a new visit) you may write the following (before the trackPageView call):
_paq.push(['appendToTrackingUrl', 'new_visit=1']); // (1) forces a new visit
_paq.push(["deleteCookies"]); // (2) deletes existing tracking cookies to start the new visit
// the two lines must be above the call to track* function
_paq.push(["trackPageView"]);
When the page loads, a new visit will be created in Piwik. Note: this code should only be displayed once after the user logged in; if you leave this code in all the page views, it would create a new visit for each page view and make your Piwik reports much less useful. The GeoIP databases are sold by MaxMind. MaxMind sells different databases, each with different amounts and types of information.
The country, region and city databases can be used to determine the location of an IP address with different amounts granularity:
The ISP and Organization databases can be used to determine the ISP and company of an IP address.
You can find more information on the commercial databases here.
MaxMind also provides two free databases that are less accurate than the commercial ones. One of the free databases can only be used to determine an IP address' country. The other, called GeoLite City, can be used to determine the same information as the commercial city database.
Needless to say, we recommend using one of the city databases.
You can download each of the free databases here.
Keep in mind that geolocation data will eventually become out of date. It is recommended you update your databases at least once a month.* The free databases are updated once a month on the first Tuesday.
* NOTE: We are currently working on an auto-updator for GeoIP databases. It will be in Piwik v1.9.1.
Once you get the database you want to use copy it to Piwik's path/to/piwik/misc/ subdirectory. If you're using the GeoLite City database, make sure you rename it from GeoLiteCity.dat to GeoIPCity.dat. This will help you avoid some potential problems.
If you're using Ubuntu or Debian run the following command:
sudo apt-get install php5-geoip php5-dev libgeoip-dev
If you have to build the extension by hand, first make sure you have the following installed:
Then run the following command:
sudo pecl install geoip
Finally, add the following to your php.ini file:
extension=geoip.so
Once the PECL extension is installed, you must configure it. Add the following to your php.ini file:
geoip.custom_directory=/path/to/piwik/misc
Replace /path/to/piwik with the path to your Piwik installation.
And finally, if you are using the GeoLite City database there is one more thing you need to do. The PECL extension won't recognize the database if it's named GeoLiteCity.dat so make sure it is named GeoIPCity.dat.
Restart the webserver and the GeoIP extension should now be loaded and working in Piwik > Settings > Geolocation.Installing the module
If you're using Ubuntu or Debian, run the following command:
sudo apt-get install libapache2-mod-geoip
If you're using a system that uses RPM, you can try the following command:
sudo yum install mod_geoip
If you can't do either of these, you may have to build the module by hand.
Configuring the module
Open the GeoIP configuration file for the module (it can be located at /etc/apache2/mods-enabled/geoip.conf) and add the following lines:
GeoIPDBFile /path/to/database.dat
GeoIPScanProxyHeaders On
If you have multiple GeoIP databases (for example, a city one and an ISP one), you can add multiple GeoIPDBFile lines.
Installing the module
First, check if your build of nginx is already using the GeoIP module. Run the following command:
nginx -V
If the output contains
--with-http_geoip_modulethen you don't have to do anything to install it. You just have to configure nginx to use it.
If it doesn't contain
--with-http_geoip_modulethen you'll have to build nginx yourself, passing
--with-http_geoip_moduleto
./configure. For more information on building nginx, see this.
Configuring the module
Open your server configuration file and add the following to the http section:
geoip_country /path/to/CountryGeoIP.dat
geoip_city /path/to/GeoIPOrLiteCity.dat;
Replace
/path/to/CountryGeoIP.datwith the path to your GeoIP country database and replace
/path/to/GeoIPOrLiteCity.dat with the path to your GeoIP city database.
IMPORTANT: For the nginx module, you must provide both a country database and city database. If you just provide a city database, Piwik will not see any country information.
If you're using an Organization or ISP database, you can add it to the config with:
geoip_org /path/to/GeoIPISPOrOrg.dat
Unfortunately, you can only supply one database here for the nginx module, so if you have both the ISP and Organization database, you will have to pick one to use.
Now make sure the following parameters are passed to fastcgi:
fastcgi_param GEOIP_ADDR $remote_addr;
fastcgi_param GEOIP_COUNTRY_CODE $geoip_country_code;
fastcgi_param GEOIP_COUNTRY_NAME $geoip_country_name;
If you're using a city database, add the following parameters:
fastcgi_param GEOIP_REGION $geoip_region;
fastcgi_param GEOIP_REGION_NAME $geoip_region_name;
fastcgi_param GEOIP_CITY $geoip_city;
fastcgi_param GEOIP_AREA_CODE $geoip_area_code;
fastcgi_param GEOIP_LATITUDE $geoip_latitude;
fastcgi_param GEOIP_LONGITUDE $geoip_longitude;
fastcgi_param GEOIP_POSTAL_CODE $geoip_postal_code;
If you're using an organization database, add the following parameters:
fastcgi_param GEOIP_ORGANIZATION $geoip_org;
That's all, folks. Enjoy!
If you want to know the location of the visits your website received before you started using Piwik with GeoIP, we've prepared a script that will help you. This script will geolocate every one of your visits that have not been located. Since it goes through every visit in your database, it will take a very long time to run.
The script is called geoipUpdateRows.php and is located in the misc/others subdirectory of your Piwik installation. You don't need to do anything special to run it, just cd into the directory and run:
php ./geoipUpdateRows.php
Things you should note:
ALTER TABLE `piwik_log_link_visit_action` ADD INDEX `transitions_url` ( `idaction_url` , `idsite` , `server_time` ); ALTER TABLE `piwik_log_link_visit_action` ADD INDEX `transitions_url_ref` ( `idaction_url_ref` , `idsite` , `server_time` ); ALTER TABLE `piwik_log_visit` ADD INDEX `transitions` ( `visit_entry_idaction_url` , `idsite` , `visit_last_action_time` );We have confirmed that these indexes drastically improve performance for pages that had a fairly low share of the overall traffic. They do add a little extra complexity when inserting new logs but speeding up Transitions also means having the queries it does out of system in a shorter amount of time, which in turn has a positive impact on tracking performance. You don't need all of these indexes. Instead, you can add them one by one until the performance of Transitions is satisfactory. If you are a power user and you tried this out, we would really appreciate to hear about your experience. Please get in touch with us.
[Tracker]the following:
[Tracker]
trust_visitors_cookies = 1 <noscript><p><img src="http://piwik-server.com/piwik.php?idsite=1" style="border:0" alt="" /></p></noscript>
Replace with the following:
<noscript><p><img src="http://piwik-server.com/piwik.php?idsite=1&rec=1" style="border:0" alt="" /></p></noscript>
After making this change and adding &rec=1, visitors with disabled Javascript will execute the noscript and will load the piwik.php image and will have their traffic recorded in Piwik.
Note: bots will also be tracked with this technique. If you wish to track visitors, but not track bots, see this blog post for a solution. [General]
live_widget_visitor_count_last_minutes=10
You can also use the Adobe AIR application to load your Piwik reports onto your desktop
[Tracker]
visit_standard_length = 1800 in your config/config.ini.php file. _paq.push(['setConversionAttributionFirstReferrer', true]);
core/DataFiles/SearchEngines.php
Each search engine is defined by a new line with the following format:
"main-url.com" => array( "Search engine name", "keyword parameter", [optional path containing the keyword], [optional charset used by the search engine])
For example, for Yahoo!
"search.yahoo.com" => array("Yahoo!", "p", "search?p={k}"),
The macro {k} will be automatically replaced by the keyword to link to the search engine page for the keywords found in your Piwik reports. The main search engine URL has to be at the top of the list for the given search Engine.
Note that some search engines can have several variable names to define the keyword, you can specify an array of names. For example, for the search engine Baidu.com, the keyword can be found in "wd", "word", or "kw", and the keywords are encoded in the charset "gb2312". The line for Baidu.com looks like:
"www.baidu.com" => array("Baidu", array("wd","word","kw"), "s?wd={k}", "gb2312"),
When adding a search engine, please also submit the search engine icon, for the directory plugins/Referers/images/
Please submit to the Piwik team the new search engine line in SearchEngines.php and the icon; we will add it for the next release! We are always looking for more quality developers to join the Piwik fun! If you want to be listed on the Piwik Consulting page, you need to know about Piwik internals: please have a look at the developer documentation, the code and the coding standards that we use to review submitted code. To be an official Piwik Consultant, you need to either:
We will then review your work and consider adding you in the official Piwik Consulting listing.
For inspiration, please have a look at the Piwik roadmap ; the list contains lots of interesting problems to solve, in different fields: performance and scaling, User Interface, Web analytics reports, core mechanisms, Plugins related tasks, etc.
If you need more information or if you want to become a Piwik consultant, please contact us at hello@piwik.org : we are looking forward to helping you![...]
// Add this line before the trackPageView() call
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
[...]
_paq.push(['setLinkTrackingTimer', 750]); // increase to 750 milliseconds[Tracker]
enable_language_to_country_guess = 0
If you want to improve the country detection accuracy in Piwik, setup Geo Location now. [Debug]
disable_merged_assets = 1_paq.push(['trackPageView']); you can add the following line _paq.push(['setRequestMethod', 'POST']);
[General]
disable_checks_usernames_attributes = 1 [proxy]
host = ; Proxy host: the host name of your proxy server (mandatory)
port = ; Proxy port: the port that the proxy server listens to. There is no standard default, but 80, 1080, 3128, and 8080 are popular
username = ; Proxy username: optional; if specified, password is mandatory
password = ; Proxy password: optional; if specified, username is mandatory
Once configured, Piwik will contact external hostnames using this proxy server. /etc/init.d/mysql restart. If you are on a shared web hosting, we recommend contacting your web host and ask them to investigate why it fails to connect to the Mysql server.
#0 Piwik_ErrorHandler(2, gzuncompress() [function.gzuncompress]: data error, /path/piwik/core/Archive/Single.php, 250, Array ([name] => Referers_searchEngineByKeyword,[typeValue] => blob,[table] => piwik_archive_blob_2009_05,[...]
You can find "piwik_archive_blob_2009_05". Please delete this table in your Piwik database. Piwik will process it again next time you are viewing reports. This will fix the issue. [mail]
defaultHostnameIfEmpty = mydomain.com
This will affect all emails sent from Piwik: Password reminder, Email reports. You can also change the default email address "From:" in PDF reports emails. max_execution_time = 0
This will ensure that Piwik always has enough time to process your analytics reports. [General] enable_trusted_host_check=0This feature was developed as a "Security Best Practise", following a suggestion by a security researcher working with Piwik through our Security Research program.
[General]
enable_framed_pages=1.
If you also wish to enable the "Settings" pages (Manage websites, Users, etc.) to load in an iframe you can also add the setting:
enable_framed_settings=1
See also: How do I enable users to login into Piwik inside an iframe? [log]
logger_message[] = "screen"
logger_error[] = "screen"
logger_exception[] = "screen"
If you wish to debug a live server in production, you can enable logging so that it only outputs the message if you manually append "&debug" in the URL. Under the section [log] in your config.ini.php you can add the following:
log_only_when_debug_parameter = 1
All logging configuration options can be found in config/global.ini.php
[Debug]
enable_sql_profiler = 1apc.include_once_override = 0
apc.mmap_file_mask = /dev/zero
;extension=php_openssl
and restart the webserver. The error should be resolved.
[General]
enable_sql_optimize_queries=0 Find out more about the OpenX ad server.
English
Feedback on this page
Have you found an error in this page, or do you think some information is missing or not clear? We appreciate you taking the time to send us your suggestions and feedback on this page.