{"componentChunkName":"component---node-modules-gatsby-theme-blog-core-src-templates-post-query-js","path":"/piwik-and-wordpress-on-synology-dsm/","result":{"data":{"site":{"siteMetadata":{"title":"one melo a day","social":[{"name":"twitter","url":"https://twitter.com/melo0187"},{"name":"github","url":"https://github.com/melo0187"}]}},"blogPost":{"__typename":"MdxBlogPost","id":"23414b50-56eb-5a04-9086-9677e3f48871","excerpt":"This is only my second post and I started only 3 weeks ago, but I have been wondering ever since about one question: Would people actually…","body":"function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\n/* @jsx mdx */\nvar _frontmatter = {\n  \"layout\": \"post\",\n  \"title\": \"Piwik and WordPress on Synology DSM\",\n  \"author\": \"melo\",\n  \"date\": \"2016-01-10T20:44:43.000Z\",\n  \"categories\": [\"analytics\", \"blogging\", \"DiskStation\", \"Technical\"],\n  \"slug\": \"piwik-and-wordpress-on-synology-dsm\",\n  \"draft\": false,\n  \"meta_title\": \"Piwik and WordPress on Synology DSM\"\n};\n\nvar makeShortcode = function makeShortcode(name) {\n  return function MDXDefaultShortcode(props) {\n    console.warn(\"Component \" + name + \" was not imported, exported, or provided by MDXProvider as global scope\");\n    return mdx(\"div\", props);\n  };\n};\n\nvar layoutProps = {\n  _frontmatter: _frontmatter\n};\nvar MDXLayout = \"wrapper\";\nreturn function MDXContent(_ref) {\n  var components = _ref.components,\n      props = _objectWithoutProperties(_ref, [\"components\"]);\n\n  return mdx(MDXLayout, _extends({}, layoutProps, props, {\n    components: components,\n    mdxType: \"MDXLayout\"\n  }), mdx(\"p\", null, \"This is only my second post and I started only 3 weeks ago, but I have been wondering ever since about one question: Would people actually come to visit this blog?\"), mdx(\"h2\", {\n    \"id\": \"the-itch\"\n  }, \"The itch\"), mdx(\"p\", null, \"To me this is an intriguing question. It made other questions pop up as well. Would visitors come along all by themselves? Would I need to promote this blog? Where and how to promote it and how to determine whether my promotion efforts are successful or not? So here it was, the itch I wanted to scratch.\"), mdx(\"h2\", {\n    \"id\": \"the-scratching\"\n  }, \"The scratching\"), mdx(\"p\", null, \"To start finding answers to above questions (and thus scratching that itch), I decided to give Piwik a try. Piwik is an open source analytics platform and as such is more than capable to answer my questions (and surely many more). Head over to \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"http://piwik.org/\"\n  }), \"their website\"), \" to find out more. Besides Piwik being able to answer my questions, the second reason I decided to go with Piwik was one of convenience: It is available on \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://www.synology.com/en-global/dsm/app_packages/Piwik\"\n  }), \"Synology DSM\"), \", which I am currently using to run this blog, Jenkins on Tomcat, a little NodeJS app to generate my CV website etc.\"), mdx(\"h2\", {\n    \"id\": \"how-to-scratch-that-specific-itch\"\n  }, \"How to scratch that specific itch\"), mdx(\"p\", null, \"So let me explain how to get Piwik installed and setup to track your WordPress blog, but beware: I am using both applications on my Synology Diskstation, which are both available in the DSM Package Center, so please do not expect me to explain how to manually install them. There is documentation by the specific projects for that. Besides, on DSM you can one-click-install Piwik and WordPress from DSM Package Center and both have click through setups. They both require PHP and a MySQL type DB, like MariaDB, which is also available in Package Center. If you require help installing Wordpress on your DSM, have a \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://www.youtube.com/watch?v=hx_dIiKskIE\"\n  }), \"look at this\"), \". WordPress setup is quick and easy. Similarly for Piwik after you installed it from DSM Package Center, it appears in the DSM app drawer and by clicking that newly created Piwik icon a new browser tab opens with the Piwik setup wizard. However, there might be a few things to note about Piwik setup. The setup step 3. \\u201CDatabase Setup\\u201D requires an existing database user and it\\u2019s password and the user needs permission to create a new database instance and tables within that instance. Keep that in mind when providing the user credentials. You might be able to create a specific database instance and a specific user with the required privileges beforehand, but I went for the lazy (and potentially unsafe?) option. In step 5. \\u201CSuper User\\u201D you provide a \", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"new\"), \" username and password that you want to use to administer your Piwik installation. This is not related to the credentials provided in step 3, so do not let the setup wizard confuse you. In step 6. you need to provide your blog\\u2019s URL. This will add your blog to Piwik, but tracking will not be setup for you at that point. We will do this later, don\\u2019t worry. Step 7. illustrates the required tracking code. Since we want to track our WordPress visits we won\\u2019t add this code to the blog ourselves, but will instead use the \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://de.wordpress.org/plugins/wp-piwik/\"\n  }), \"WP-Piwik\"), \" plugin to handle this for us. In my case step 8. showed the option to anonymize the last 2 bytes of visitor\\u2019s IP addresses to comply with German privacy laws. I guess Piwik determined that this blog must be \\u201Cfrom Germany\\u201D\\xA0based on the website timezone defined in step 6. They did not provide any reference to a law paragraph requiring you to do so, but I did choose to adhere. Piwik is now installed, setup and ready to\\xA0go. Now we head over to our WordPress dashboard to install WP-Piwik. You obviously need to be logged in for this, so head over to the dashboard (address should be something like \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"http://yourDomain/wordpress/wp-admin\"\n  }), \"http://yourDomain/wordpress/wp-admin\"), \"), log in with your WordPress user and go to \\u201CPlugins\\u201D -> \\u201CAdd New\\u201D and search for WP-Piwik. Click on \\u201CInstall Now\\u201D and on \\u201CActivate Plugin\\u201D afterwards. Then we setup WP-Piwik (\\u201CSettings\\u201D -> \\u201CWP-Piwik\\u201D on the left hand dashboard menu) to connect it to our Piwik instance. For Piwik mode I chose self-hosted PHP API, because I have both WordPress and Piwik installed on the DiskStation. In this case Piwik path is /volume1/web/piwik. The auth token is unique. To get your auth token, log in to Piwik, click at your user name (top right) and click at \\u201CAPI\\u201D (left sidebar menu) as described \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"https://wordpress.org/plugins/wp-piwik/faq/\"\n  }), \"here\"), \". We leave auto config checked, so that it will automatically choose our blog from our Piwik sites by URL. Remember Piwik setup step 6, where we added our site by URL. That is it and you can click \\u201CSave changes\\u201D. If successful, something like this should show up: \", mdx(\"em\", {\n    parentName: \"p\"\n  }, \"WP-Piwik 1.0.5 is successfully connected to Piwik 2.11.2. You are running WordPress 4.4\"), \" But do not be fooled here! We have only finished the setup needed by the plugin to interact with your Piwik instance! We still need to enable tracking by making the plugin add the required tracking code to our blog so click \\u201CEnable Tracking\\u201D and select \\xA0an option for \\u201CAdd tracking code\\u201D. I chose \\u201CUse js/index.php\\u201D, because it supports conditional-GET and Last-Modified, so piwik.js can be cached by the browser and it supports deflate/gzip compression, shrinking the data transfer to 8K, which is described \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"http://demo.piwik.org/js/README\"\n  }), \"here\"), \". Compression and cache support sounds nice, doesn\\u2019t it? Proxy support is not interesting for me, because I don\\u2019t mind that people know where my Piwik installation is. Circumvent browser-based privacy filters is also unimportant since I want to respect visitor\\u2019s do-not-track preferences, which was available as an option during Piwik setup step 8. Tracking code preview and noscript code are empty, but don\\u2019t bother about that for now. It will update as soon as you save your settings and the tracking code gets added to your site. There are a lot of other options to decide what to track and what not. I want to track search, 404, enabled annotations, track RSS and filter WordPress admin, editor\\xA0and author visits, because I don\\u2019t want to count my own visits when working on my blog. When you are done, click \\u201CSave changes\\u201D, which updates the code previews.\"), mdx(\"h2\", {\n    \"id\": \"the-relief\"\n  }, \"The relief\"), mdx(\"p\", null, \"We have installed Piwik, added our WordPress blog to it and added the tracking code to our blog with the help of WP-Piwik. This means we are all set up to track our blog visitors, so let us test this already! To \\u201Cfake\\u201D a visit I started an incognito browser session and visited my blog and there it was: Both Piwik and WP-Piwik displayed the visit in all it\\u2019s glory and with quite a lot of data: The visitor\\u2019s device operating system, the browser they used and the display resolution they viewed your page with along with their geographical location but wait: Why is my visit record saying I visited my blog from the US?\"), mdx(\"h2\", {\n    \"id\": \"polishing\"\n  }, \"Polishing\"), mdx(\"p\", null, \"My first visit\\u2019s IP was recorded in an anonymized form, which we decided to do so in Piwik setup step 8., but that is no reason to claim that the visit came from the US when it actually came from Germany. Luckily, this is fixable and the fix is quick and easy. Login to Piwik, click on \\u201CAdministration\\u201D at the top right and choose \\u201CSettings\\u201D -> \\u201CGeolocation\\u201D in the menu on the left. There you find easy to follow instructions on how to setup accurate geolocation by switching from the default to the GeoIP (Php) location provider. In essence you simply download the GeoLiteCity database and copy that file into /volume1/web/piwik/misc on your diskstation. Once you have done so, you can activate the GeoIP (Php) location provider and instantly see the results on the right and also compare the geolocation\\xA0determined by the different providers. For further information about improving the recorded geolocation you can \", mdx(\"a\", _extends({\n    parentName: \"p\"\n  }, {\n    \"href\": \"http://piwik.org/faq/how-to/#faq_163\"\n  }), \"check out the Piwik FAQ\"), \". Now that we have switched to an accurate location provider, we will have Piwik record the correct location of our visitors. However this will not change/update the location of past visits, like our \\u201Cfake\\u201D test visit.\"), mdx(\"h2\", {\n    \"id\": \"wrapping-up\"\n  }, \"Wrapping up\"), mdx(\"p\", null, \"It is nice to have both Piwik and Wordpress available as packages for the Diskstation. The installation is quick and easy and with the help of the WP-Piwik plugin you can easily connect your blog to Piwik and start tracking you blog visitors to get an idea about how popular your blog is and to get the data you need to actually improve it. To this end, let\\u2019s see how I can grow my reader base, get feedback and make my blog become a place of discussion and learning.\"));\n}\n;\nMDXContent.isMDXComponent = true;","slug":"/piwik-and-wordpress-on-synology-dsm/","title":"Piwik and WordPress on Synology DSM","tags":[],"keywords":[],"date":"January 10, 2016"},"previous":{"__typename":"MdxBlogPost","id":"f5e5eb0f-acc2-5122-b746-9323c6d47ea9","excerpt":"My first blog post So here we finally are, me writing my first blog post. I have been thinking about starting my own blog for a while now…","slug":"/getting-started-blogging/","title":"Getting started blogging","date":"December 18, 2015"},"next":{"__typename":"MdxBlogPost","id":"fc826d5e-b7dd-534f-ba51-b58e5b7fdecb","excerpt":"From the moment I got my DiskStation and made it available online, I wanted to try HTTPS. Organizations that issue certificates to use for…","slug":"/get-https-on-diskstation-with-lets-encrypt/","title":"Get HTTPS on DiskStation with Let's Encrypt","date":"January 28, 2016"}},"pageContext":{"isCreatedByStatefulCreatePages":false,"id":"23414b50-56eb-5a04-9086-9677e3f48871","previousId":"f5e5eb0f-acc2-5122-b746-9323c6d47ea9","nextId":"fc826d5e-b7dd-534f-ba51-b58e5b7fdecb"}}}