Jump to content
tcnet

PageViewStatistic for ProcessWire

Recommended Posts

7 hours ago, tcnet said:

Anyway, project is on GitHub now. But it's probably the last time. For updates and new features check my blog. Thank you!

Thanks for setting this up! 🙂

Of course this won't be a problem for everyone, but personally I avoid direct downloads. Here are a few reasons:

  • With direct downloads I can't easily validate the package to make sure it is indeed the original one in case the server has been compromised or something along those lines — which of course is something that shouldn't happen, but in this regard I have more trust in GitHub than individual hosting providers / server maintainers.
  • GitHub (/ Git) allows me to see and track the full change history in case something doesn't work. This way it's easier to track what change caused the problem, why it was made (commit message), and (assuming that the module author is somewhat active on GitHub) file an issue or even submit a fixed version for approval.
  • Finally, I prefer to handle updates via either Git or Composer. It would be too much work to keep track of different blogs for individual modules, let alone download the module package every now and then to see if it has changed . GitHub makes this trivial (periodic git fetch or git pull is quite enough).

No pressure, but big thumbs up from here for always uploading modules to GitHub 👌😅

  • Like 4

Share this post


Link to post
Share on other sites
5 hours ago, tcnet said:

Today I've tested VSCode.

At least you tried 😉.

Share this post


Link to post
Share on other sites

Interesting module. It works in my local environment, but unfortunately online.

Trying to view the statistics I get an unspecific  server error (500), with Tracy debugger I get some details but don't have a clue what's happening. I assume some security setting on the host, but have no idea to find this.

Quote

message protected => "SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server v ... "
string private => ""
code protected => "42000"
file protected => "/var/www/k11065/html/site/modules/ProcessPageViewStat/ProcessPageViewStat.module"
line protected => 772
trace private =>

previous private => null
errorInfo =>

0 => "42000"
1 => 1064
2 => "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''100'' at line  ... "

 

Share this post


Link to post
Share on other sites
53 minutes ago, sujag said:

Interesting module. It works in my local environment, but unfortunately online.

Trying to view the statistics I get an unspecific  server error (500), with Tracy debugger I get some details but don't have a clue what's happening. I assume some security setting on the host, but have no idea to find this.

 

It seems to be the row LIMIT. But I cannot be reproduce it. Try to change the row limit in the configuration to another value. Please also search the problem in your PHP/MySQL environment.

Did you uploaded the files with FTP in the right transfer mode?

Share this post


Link to post
Share on other sites

Yes it is the row LIMIT but it's indepedent of the value. Changing the value just alters the text of the error message:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''100''

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''25''

But I just notices, that this server still works with PHP5.6 I ask the hoster, if it is possible / planned to upgrade.

 

Share this post


Link to post
Share on other sites
17 minutes ago, sujag said:

Yes it is the row LIMIT but it's indepedent of the value. Changing the value just alters the text of the error message:

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''100''

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''25''

But I just notices, that this server still works with PHP5.6 I ask the hoster, if it is possible / planned to upgrade.

 

No, this are single quotes: ''
I guess you uploaded the files in the wrong transfer mode. Otherwise, the stored int variables becoming strings. I don't know why. Or it has to do with PDO.

Edited by tcnet

Share this post


Link to post
Share on other sites

no it was indeed the old PHP-Version. I finally found the place to switch and now the module works as expected. Thank you

Share this post


Link to post
Share on other sites
Just now, sujag said:

no it was indeed the old PHP-Version. I finally found the place to switch and now the module works as expected. Thank you

Thank you too! I was assuming that it's the database driver.

Share this post


Link to post
Share on other sites

Another question. Would it be possible to partly anonymize the IP-Adresses?

German (european?) privacy laws prohibit the permanent logging of ip-adresses as private data. A common solution that respects this while still allowing some analysis is to set the last triplet to 0 or xxx before it get's stored.

Share this post


Link to post
Share on other sites
Just now, sujag said:

Another question. Would it be possible to partly anonymize the IP-Adresses?

German (european?) privacy laws prohibit the permanent logging of ip-adresses as private data. A common solution that respects this while still allowing some analysis is to set the last triplet to 0 or xxx before it get's stored.

Nobody except you can see the IP's! Where is the problem? If IP's stored with xxx in the database then it's no more possible to count the visitors and this would make the whole module worthless.

Share this post


Link to post
Share on other sites

There is no need to xxx the whole IP-address, this would indeed make no sense, only the last three digits are masked.

Google analytics implements this as IP Anonymization (or IP masking) in Analytics to allow compliance to privacy statements and laws.  https://support.google.com/analytics/answer/2763052?hl=en

Share this post


Link to post
Share on other sites
16 hours ago, tcnet said:

Nobody except you can see the IP's! Where is the problem?

This by itself is already a problem. Given the gdpr privacy laws it's reasonable to justify why IPs need to be processed for actually handling the http request, but storing it (especially indefinitely) is a completely different ballpark. IPs can be used to identify people and therefore should be treated like that. It's not simple nor accessible to the everyday person, but if you have access to an ISPs records you can trace back an IP at a certain time to a certain household and potentially a single person.

Share this post


Link to post
Share on other sites

If someone doesn't want to see the IP addresses, they can hold their hands over them. Over and out!

Share this post


Link to post
Share on other sites

Hi,

I got this error too.

Quote

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ''50'' at line 1

PHP 7.1
MariaDB 10
ProcessWire 3.0.149

Gideon

Share this post


Link to post
Share on other sites
15 minutes ago, Gideon So said:

Hi,

I got this error too.

PHP 7.1
MariaDB 10
ProcessWire 3.0.149

Gideon

Sames to be a bug in PDO in some PHP versions.

Please open ProcessPageViewStat.module and change line 771
from: $query->bindValue(':rowlimit', $rowlimit, \PDO::PARAM_INT);
to: $query->bindValue(':rowlimit', (int) $rowlimit, \PDO::PARAM_INT);

Share this post


Link to post
Share on other sites

Hi @tcnet,

On 11/4/2020 at 1:03 PM, tcnet said:

I just updated to version 1.0.6 which should solve the problem.

New version works fine. Thanks.

Gideon

Share this post


Link to post
Share on other sites

Hi!

Great module!

But is it GDPR compliant?
Is the module uses any js or cookies? Or is it just based on php?
It is possible to xxx the last part of the ip adress (after checking the location)?

 

Share this post


Link to post
Share on other sites

I keep getting these errors (just one of them at a time)…

PHP Notice: Undefined offset: 1 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:3310
PHP Notice: Undefined offset: 1 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1743
PHP Notice: Undefined offset: 3 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1656
PHP Notice: Undefined offset: 3 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1619

thoughts?

Share this post


Link to post
Share on other sites
2 hours ago, fruid said:

I keep getting these errors (just one of them at a time)…

PHP Notice: Undefined offset: 1 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:3310
PHP Notice: Undefined offset: 1 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1743
PHP Notice: Undefined offset: 3 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1656
PHP Notice: Undefined offset: 3 in /home/.sites/66/site2760076/web/site/modules/ProcessPageViewStat/func/useragent.php:1619

thoughts?

As you can see, it's not an "error". It's an "PHP Notice". Why you get this Notice? Now, you didn't give me any info where you have seen this notice so I cannot help you. By the way, useragent.php is not my work. https://www.toms-world.org/blog/parseuseragentstring/

Share this post


Link to post
Share on other sites

There is a new version of parseuseragentstring available. I just updated the module. But at the moment I cannot access the module edit page. Something must be wrong here. Can an admin look into that?

Share this post


Link to post
Share on other sites

I solved the problem with the login. Version 1.0.7 now available.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Cybermano
      Food Allergens Module
      A simple List of Food Allergens
      My needs were to provide a simple list of food allergens for our clients with restaurant related activity.
      The idea was to simply output the list (to speed up the data entry) without leaving the food menu editing, eg. opening another page in new tab or window.
      This isn't a perfect solution, but it works fine for my needs and I decided to share the base idea.
      This could also be easily used to show little notes or short "vademecum", not only for the list of food allergens.
      ---
      Main features
      The basis
      All moves from a short editing of the module in this tutorial: How to create custom admin pages by @bernhard
      First of all it creates an empty admin page, with a dedicated permission to let safe-user to see it (this permission has to be created as a new ones, manually or by the module).
      Once the page is created, I have hooked its behaviour into the ready.php, to show the content (basically a list).
      A step further
      With the tips of  @bernhard, @Soma (and many others), see here , the magic happens. 
      The new page will be shown as a panel, so editors will not abandon their data entry to have a quick view to the list.
      A little further
      Why scroll to the top of the page to click a link?
      The next step was to create a sticky button only in the food menu pages.
      Again with a @bernhard tip I moved into the customization of this simple module and the related hook.
      ---
      How to use this module
      After installed, it creates the page /admin/page/allergens/ and the module is to be setted up. The first field is a CKEditor with multi-language. This is the place where to write the informations that will be shown into the page. The next field is a simply text-area where to place a bit of JS that will be appended to the markup of the text (omit the 'script' tags). I also putted a checkbox with a silly statement: this to think at least twice on the safety of the written JS. Now comes the first way to display the link to the page
      Field Note with Link. Enable and save it. The module will display a new row with 4 selects (1 standard and 3 ASM):
      View mode (to show the page as Panel or as Modal PopUp); Templates to select: select one or more and save before proceed, so the  asm-select of the pages will be populated showing all the pages of the selected templates. Pages to select: also here select at least one and save before proceed to populate the asm-select for fields only with the ones that belong to the selected pages. Select the fields where to place the note and save again. That's all: now you will find into the notes of the selected fields the link "See the List of Allergens".
      At the same way, the option for the sticky button, but with a plus
      The field select is obviously unnecessary, but you could play with the last row: the inline styles to fix your sticky button where you like. Here you could set the sticky position of the <div> and the absolute ones of the <a>.

      Video Explanation
      In these screencasts you could see a custom JS that show a "copy" button near a "hanna-code" call.
      This because I've set a specific one for each allergen to show up a tooltip in the front end.

      Registrazione #33.mp4  

      Registrazione #34.mp4 ---
      Last but not the least
      Actually it works fine for my needs, even if it's much improvable: I'm working on the permissions creation, the uninstall section, a separate configs and defaults and how to include the hook into the module leaving free the ready.php. According to a simpler uninstall. Also I would make the link text as a dynamic text field, so it will be more flexible.
      I always learn a lot here, so I would share my code for whom it could be interested.
      I removed the hanna code references, but I provide you the html list of the allergens, English and Italian too, so you can paste them into the "source" of the CKEditor field to have a ready to use module.
      Obviously you are free to modify the code as per your needs.
      Please, keep in mind that I'm not a pro coder and I beg your pardon for my verbosity (speaking and coding). 😉
      I hope be helpful or for inspiration.
      Bye
      ready.phpList-ITA.htmlList-ENG.htmlAllergens.module
      README.md
    • By Robin S
      This module is sort of an upgrade to my earlier ImageToMarkdown module, and might be useful to anyone working with Markdown in ProcessWire.
      Copy Markdown
      Adds icons to images and files that allow you to copy a Markdown string to the clipboard. When you click the icon a message at the top left of the screen notifies you that the copying has occurred.
      Screencast

      Note: in the screencast an EasyMDE inputfield is used to preview the Markdown. It's not required to use EasyMDE - an ordinary textarea field could be used.
      Usage: Images
      When you hover on an item in an Images field an asterisk icon appears on the thumbnail. Click the icon to copy an image Markdown string to clipboard. If the "Description" field is populated it is used as the alt text.
      You can also open the "Variations" modal for an image and click the asterisk icon to copy an image Markdown string for an individual variation.
      Usage: Files
      When you hover on an item in a Files field an asterisk icon appears next to the filename. Click the icon to copy a link Markdown string to the clipboard. If the "Description" field is populated it is used as the link text, otherwise the filename is used.
       
      https://github.com/Toutouwai/CopyMarkdown
      https://processwire.com/modules/copy-markdown/
    • By BitPoet
      I've realized that I've been jumping back and forth between the PW API docs and the source code for site modules far too much. The idea to hold all necessary documentation locally in one place has occurred to me before, but getting PHPDocumentor et al set up and running reliably (and producing readable output) as always been too much of a hassle. Today I was asked how I find the right hooks and their arguments, and that inspired me to finally get my backside down on the chair and whip something up, namely the
      Module Api Doc Viewer
      ProcessModuleApiDoc
      It lets you browse the inline documentation and public (optionally also protected) class/method/property information for all modules, core classes and template files in the ProcessWire instance. The documentation is generated on the fly, so you don't have to remember to update your docs whenever you update a module.
      The module is quite fresh, so expect some bugs there. Behind the scenes it uses PHP-Parser together with a custom class that extracts the information I needed, and the core TextformatterMarkdownExtra module for rendering the description part in the phpdoc style comments.
      This is not a replacement / competitor to the API Viewer included in the commercial ProDevTools package. There is quite some information included in the inline documentation that my module can't (and won't) parse, but which makes up parts of the official ProcessWire API docs.
      This, instead, is a kind of Swiss army knife to view PHPDoc style information and get a quick class or function reference.
      If you feel daring and want to give it a spin, or if you just want to read a bit more, visit the module's GitHub repository.
      This is the overview page under "Setup" -> "Module API Docs":

      And this is what the documentation for an individual class looks like:

      The core module documentation can of course be found online, but it didn't make sense not to include them.
      Let me know what you think!

    • By tcnet
      File Manager for ProcessWire is a module to manager files and folders from the CMS backend. It supports creating, deleting, renaming, packing, unpacking, uploading, downloading and editing of files and folders. The integrated code editor ACE supports highlighting of all common programming languages.
      https://github.com/techcnet/ProcessFileManager

      Warning
      This module is probably the most powerful module. You might destroy your processwire installation if you don't exactly know what you doing. Be careful and use it at your own risk!
      ACE code editor
      This module uses ACE code editor available from: https://github.com/ajaxorg/ace

      Dragscroll
      This module uses the JavaScript dragscroll available from: http://github.com/asvd/dragscroll. Dragscroll adds the ability to drag the table horizontally with the mouse pointer.
      PHP File Manager
      This module uses a modified version of PHP File Manager available from: https://github.com/alexantr/filemanager
       
    • By teppo
      Admin Restrict Branch Select is an add-on / companion module for Admin Restrict Branch. With this module enabled, you can manually select more than one branch parent per user via the branch_parent field, and users with more than one option selected will be able to switch between those while editing site content. Switching between branches is done via a select field injected at the top of the page tree.
      Note that users are still limited to one branch at a time: this module will not make it possible to view multiple branches at the same time.
      When the module is installed, it will automatically update the branch_parent field if deemed necessary, i.e. if it isn't yet configured to allow selecting multiple pages. You can make changes to the field later, if you want to restrict selectable options by template, use asmSelect instead of PageListSelectMultiple, etc. 
      This is an early beta release, so be sure to test carefully before enabling this module in production!
      https://processwire.com/modules/admin-restrict-branch-select/
      https://github.com/teppokoivula/AdminRestrictBranchSelect
×
×
  • Create New...