Jump to content

David Karich

Members
  • Posts

    156
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by David Karich

  1. Hey @ryan, I'm so excited about the feature. The two big things I think ProcessWire is missing are versioning and a lack of global asset management. ProDrafts was a good approach so far, but had limitations. Can you perhaps briefly explain how the versioning module works? ProDraft had the approach that everything I save is saved in a draft until I publish. Is this also the approach here, that every time I save a page a new version of the last state before saving is created or do I have to create a new version myself beforehand, in which I work, revise a draft and then "restore" it when I'm done as a form of "fake" publishing?

    • Like 2
  2. 23 minutes ago, ShadowByte said:

    Hello,
    nice module.

    Is it possible to get all page hits from last week (per day) / month (per week) / year (per month) to fill a chart for the admin dashboard?

    Thank you in advance

    Greetings

     

    No, this is not possible. As described in the cons, the hits are only summed up and no historical data is collected. The module has no claim to be a statistics module, only a small helper for a quick overview of accesses and interest-based sorting. Please ask @bernhard, he once wrote an extension as a module, which should extend my module with these functions.

    • Like 2
  3. 5 hours ago, kongondo said:

    Hi all,

    I wanted to update you on the progress of the next MM as discussed from this post onwards. Here's a very short preview of the next MM.

    It is still very early days. Nothing is polished and things may change. My main focus is on the functionality although I spent a bit of time on the GUI. I have spent considerable time thinking about the conceptual design, especially for the API and I am quite pleased with that so far. 

    Before you ask, I don't know when this will be ready. It is not a small re-write. I do know that it won't be until after the summer though, that's for sure. Happy to get early feedback, thanks.

     

     

    Wow. Looks absolutely incredible. 😍 Really gives you a feel of an asset library. Great work. Looks intuitive too. Can't wait to test it out. 👍

    Two questions: how should uploads happen? Can I just upload assets via DND in a folder or is the "New" button meant for uploads? If so, I would give it a different name, e.g. "Upload Media".

    Second question: does the search always refer to the entire library or only to the currently selected folder? Can I change the search behaviour in an advanced mode?

    • Like 1
  4. @kongondo And because it is so much fun to think about the new MM and which requirements are more difficult to implement so far, I have another feature request. 🤪

    I have a few multi-language websites that keep running into the problem that different images have to be displayed depending on the language, e.g. because there is text on the images.

    Currently, I can only solve this in a complicated way using the PW-internal option with image tags. Personally, I find this a design workflow break in the whole PW concept, because the rest works wonderfully with the LangTabs modules. Perhaps also a feature request to @ryan at this point. 🙃

    My wish here would be to map the MM-InputfieldImage in the same way as multi-lang text fields. So with a simple language switch, select another item from the library.

    • Like 2
  5. 17 hours ago, nurkka said:

    Hi @kongondo

    First of all thank you for the awesome plugin!

    It would be really awesome if the selection would run through an interface with a folder structure. And it would be perfect if one could define per template in which folder the selection would start.

    An example: Assuming we have a folder "Employee photos" and a folder "Customers" (or a lot more folders and subfolders 😉 ), then it would be perfect if one could give the input field the information that the image selection on employee detail pages starts in the folder "Employee photos". That would be much easier for the clients/editors to work with.

    And without a folder structure, it would be great if one could define per template with which category or tag the input field starts, i.e. to have a ore-defined filter setting per template.

    Very good approach, but possibly not or not only via a template approach. I am very fond of the PW-internal possibilities of input and field dependencies (https://processwire.com/docs/fields/dependencies/). Here is a productive scenario of how I run it in an editorial workflow on another system I developed from scratch: 

    • The article template has the input fields date, category of the article (page reference or select), article images, etc. 
    • The editor can upload new images (or select existing ones from the library and add them) directly to the input field of the article images by dragging and dropping. 
    • When the new images are uploaded, they are automatically assigned in the library on the basis of the selected category and date. This eliminates a complete step of manual assignment for editors.

    @kongondo My idea for the MM: to enable a configuration for the input field that assigns new images to defined categories on the basis of other fields of the template and their values when they are uploaded. If this option is not configured, then I would also prefer the default behaviour "uncategorised" as lying in a "root folder" and the editors have to clean up themselves.

    • Like 1
  6. 20 hours ago, kongondo said:

    A question to you all, how does the powerful but potentially confusing inputfield selector work for your clients? Do they use it or would you prefer a simpler interface such as the WP one in the screenshot shown above by @David Karich?

    @kongondo From my experience, my clients are overwhelmed with the InputfieldSelector and Lister and don't know what to do with them. I would also prefer a very simple approach here: "Search field for text", optional filter options in a simple UI: file type, time period (of the upload).

    • Like 2
  7. 15 hours ago, kongondo said:

    @David Karich (or any other person who knows), in the WP Media Lib, if the user clicked on the folder 'People', would that then display media for both 'Men' and 'Women' but if they clicked on 'Women' that will only show 'Women' media? I can't tell because the counts are not showing for some 'parent' folders such as 'People' and 'Office'.

    @kongondo Sorry, I'm a bit tied up at the moment. But it behaves like real folders. When you click on "People", only two folders are displayed, but no pictures from both subfolders. I would also prefer this. Inheriting subitems in the view works well for a few folders, but not for 20, 50, 100 and then recursively over several levels lower.

    • Like 1
  8. On 3/1/2023 at 6:26 PM, kongondo said:

    Hi @David Karich,

    I would have to look into this since I haven't worked with focus points before. My guess is that they are saved with the image, in which case they will be saved with the record for the original image in the MM page (i.e., not the page where the MM image is referenced in an MM Inputfield). I'll see if/how I can extend FieldtypeMediaManager to store focus information (and perhaps other info developers might be interested in) which you will be able to access via the MM object.

    I am hoping there will be no need for breaking changes. However, until I finish building it, I cannot promise. If such changes are inevitable, I'll provide code for migration. However, with the minimal progress I've made so far, I haven't encountered any breaking changes.

    Hi @kongondo

    thank you for your feedback. Since you still ask for wishes for the new version, here are two more. 😃

    Just like the focus point, it would be very helpful to save the image description differently per page base. Example: I want to use a image several times in an article, but I want a different caption in each article.

    And the biggest wish I have to pass on: Folder, folder, folder. My clients love thinking in folders. It doesn't even have to be a real folder for PW, but just a "fake page tree". The main thing is to have the feeling of having something organised. In this context, a configuration would of course be necessary, where you can, for example, specify where the image is automatically categorised when uploading.

    An example of how it is solved, for example, in the WP-media Library as an extra plugin. Article: https://devowl.io/2020/create-folders-in-wordpress-media-library/

    image.thumb.jpeg.18b5e987527844992adb0ae7c204bf3b.jpeg

    • Like 4
  9. Two questions where I just read that you are working on a new version.

    1. what about focus points, can I define them differently on a per page basis? Or is a set focus the same for all instances of the image? If so, I would like to see this feature that I can define a different focus per page where I use an image.

    2. if I buy a license for the current version now, will it be updateable for the new version or are there any breakers here. I'm building a new project with thousands of images to be managed through the MM, so if in half a year, or whenever the new version is ready, a complete reinstall or upload is necessary, I'd rather wait until you have the new version ready.

    • Like 1
  10. On 11/21/2021 at 6:20 PM, bernhard said:

    @David Karich could you please modify the js script a little so that we can set the page id of the tracked page manually as function parameter?

    LZ0oSZN.png

    The example of the docs can then be simplified a lot from this:

    $(function(){
        if($('a.news_tag').length > 0) {
            $('a.news_tag').each(function(){
                var tPID = $(this).data("pid");
                if(tPID) {
                    $(this).on("click", function(){
                        $.post(location.pathname.replace(/\/?$/, '/') + 'phcv1', {pid: tPID});
                    });
                }
            });
        }
    });

    To something like that (untested):

    $(document).on('click', 'a[data-pid]', function(e) {
      let pid = $(e.target).data('pid');
      if(pid) PHC.track(pid);
    });

    PS: The reason why I need this is I'm using barba.js for page transitions so I need to send page tracking manually after each transition and the <body> tag is not updated from one page to the other meaning that automatic tracking via body[data-phc] does not work...

    @bernhard, I think that shouldn't be a problem. I also have other updates on the to-do list. I'll try to push it this year during my Christmas holiday. Unfortunately, I really don't have time at the moment to roll that out sooner.

    • Like 1
  11. 4 minutes ago, adrian said:

    Yeah, I understand the reasons - it's a shame PW doesn't have a dedicated endpoint that is automatically available on all installs so we don't have to deal with hacking into 404. I haven't wished for something like this many times - I wonder if maybe it should be a feature request?

     

    Now that you mention it, the first thing that strikes me is how often I have to build endpoints like this over and over again on every project. ?? I think that would be a really useful feature request, to have a fixed endpoint, which then each module can extend and have access to it.

    • Like 2
  12. 8 minutes ago, adrian said:

    Sure, that works, but I am talking about direct affiliate links - sites often have mysite.com/davidk without any preceding segment to define what it is. I kinda find this practice a bit weird, but it seems pretty common.

    Yes, I understand. Unfortunately, this case cannot be mapped with the module, because the whole core concept is based on triggering a 404 via a non-existent endpoint and hooking in before it. I wanted to keep it simple and not have to install an additional page as API endpoint and a template for it. ? 

    • Like 2
  13. 27 minutes ago, adrian said:

    or something similar with one segment that allows any alphanumeric characters.

    But this is not a problem, as long as you can define a segment in some way. I also have it in use, where segments can have any value. The segment definition via RegEx works, for example: 

    regex:^affiliate/[a-zA-Z0-9-_]+$

    For all other cases, even if I have not yet encountered one, where you can not define any segments and everything is wildcard (which you should also avoid from SEO point of view or also the potential for DDOS attacks), the module is then unfortunately not the right choice. ? 

  14. 10 hours ago, adrian said:

    Sorry, on a related note, if the template's urlsegment trailing slash is set to "yes" to force a trailing slash, you end up with two calls, so the module needs to check this setting and adjust the path accordingly.

    681700061_ScreenShot2021-02-15at8_51_37PM.png.f39f12f20a7e415a241a9b6b9997d4c9.png

    FYI - the reason I have that setting forcing the trailing slash is because I have urlsegments and pagination both turned on, and without it, URLs can end up broken.

     

    10 hours ago, adrian said:

    @David Karich - on the issue of the AJAX call from the js file - turns out if you have url segments enabled for a template, when you view a page, the entire page's html is included in the response and sent to the browser along with the "Page Hit Counter: Tracked".

    I can workaround it by adding:

    
    if($config->ajax && $input->urlSegment1 == 'phcv1') exit;

    to _init.php, but I think there needs to be a more elegant solution ?

    I have read your section about "Notice: Tracking with URL segments", but I don't think that is really the issue here. I haven't defined my urlsegments yet (I will before the site goes live), but I don't think that will prevent this issue, will it?

    Any thoughts?

     

    Yes, this is the problem described. Just tested it. Forget what I said before. This error occurs only when there are missing segment definitions with segments enabled. 

    Edit 1: Just validated it again too, there is no other way. You need to define the URL segments or leave placeholders via regex so that an endpoint can be created and there is a possibility that a 404 will be triggered. And without a segment definition a 404 will never be triggered and so the script can't hook in at that point.

    Edit 2: Consequently, the request is not going to the module, but simply to your page, which itself is the response in your console in debug mode. But the tracking endpoint can also not be placed uniformly on the root, because in cookie mode with differentiated URL segments the cookie must be stored only on this path. I will think about whether there should be an alternative way without AJAX. But I can't implement this adhoc, because I don't have the time for it and for this project no customer releases budgets anymore, because these use cases for which it was needed, work like this.

    @adrian Please define the URL segments in your project and test it, it should work with that. ? 

    • Like 1
  15. 10 hours ago, adrian said:

    @David Karich - on the issue of the AJAX call from the js file - turns out if you have url segments enabled for a template, when you view a page, the entire page's html is included in the response and sent to the browser along with the "Page Hit Counter: Tracked".

    I can workaround it by adding:

    
    if($config->ajax && $input->urlSegment1 == 'phcv1') exit;

    to _init.php, but I think there needs to be a more elegant solution ?

    I have read your section about "Notice: Tracking with URL segments", but I don't think that is really the issue here. I haven't defined my urlsegments yet (I will before the site goes live), but I don't think that will prevent this issue, will it?

    Any thoughts?

     

    I think you have the PW debug mode on, right? The response is not returned when debug mode is off. Also, all non-AJAX based requests are not processed further. https://github.com/FlipZoomMedia/PageHitCounter/blob/master/PageHitCounter.module#L643 

    Or have I misunderstood something?

    • Like 1
  16. 18 hours ago, adrian said:

    I just noticed that if you uninstall and reinstall, you get an SQL error because it's trying to create a table that already exists, so either the uninstall didn't clean things up properly (if that is the intention), or the install process needs to check to see if it already exists.

    Hi @adrian, unfortunately I can't reproduce the problem on any installation where I just tested it. The module does not handle the uninstall process manually either, it uses PW's native methods: https://github.com/FlipZoomMedia/PageHitCounter/blob/master/PageHitCounter.module#L1130 – There I'm confused unfortunately, why when uninstalling the field your MySQL table is not removed. Maybe local development environment with wrong rights? ?

    Quote

    Also, just wondering if the AJAX approach could be reserved for sites running ProCache? Is there a need otherwise for doing it this way, rather than hooking on page render? There's a good chance I am overlooking something, but just thought I'd ask.

    Surely this would also work, but this makes it in the end, I think, unnecessarily inflated in the code. The current method does not block the rendering process because rights, templates, filters, cookies, etc. have to be checked first and then an SQL query has to be waited for before it continues (even if it is only milliseconds here). It is therefore asynchronous and does not block the frontend. It clears the way for self-created AJAX requests for tracking and it works as it is implemented, for all methods. Whether ProCache is in use or not. ? 

    Quote

    Another thought - have you considered a way for us to easily extend this to log click events to track users viewing PDFs etc? Maybe this really doesn't belong within this module and should be kept as something we implement on a case-by-case basis?

    The module should never become a tracking or statistics module in its concept. There are simply enough better tools that you can use for that. It has always been and should remain so, a simple way to quickly sort by interests or get an overview without big bells and whistles. 

    Everything that is based on template, you can track with it but also. See the Custom API tracking methods. So if your downloads have a template in any form, you can also use it to map a download counter. For example, I have already mapped this with login counters. (https://github.com/FlipZoomMedia/PageHitCounter#example-tracking-a-page-hit-via-api-and-jquery)

    For everything else there is Analytics or Matomo, or the many other tools. But ask @bernhard, I don't want to anticipate anything, but he builds something great on the basis of the PageHitCounter. ? 

    • Like 1
  17. On 2/10/2021 at 9:20 PM, Zeka said:

    @David Karich Not sure, but probably it's more right to use 'return' instead 'exit()' across 'trackPageView' so we still get 404 page. Currently, I'm getting a blank page with 200 code when I directly access any page with prepended 'phcv1' segment with a template that added wether to API or automatic tracking templates list.

    Hi @Zeka, a 404 should explicitly not be triggered. This is because the AJAX request would not be valid and would return a 404 and thus an incorrect status code. In addition, I think the discussion and issue was here before on the front pages, in previous versions every hit was registered as a 404 if you installed the 404 Page Logger or other 404 monitoring tools. Which then quickly flooded the log. So the only option was to set the priority close to 0 and prevent 404s. ? 

  18. Version 2.0.0 as new master version available (PLEASE READ!)

     

    New since 2.0.0: Ignore URL segments

    If a template has URL segments configured, each hit on a different segment is counted as a new hit. Enable "Ignore URL segments" so that dynamic segments are not counted individually on the base template / page.

    New since 2.0.0: Use cookieless tracking (Experimental)

    Enable this option to not use individual cookies for tracking or if you have many different pages you want to track. The limit for cookies is 50 per domain for all cookies on the page. If the option is enabled, PHP session storage is used. Downside: you can't set the lifetime higher than configured in your PHP.ini and the session will be terminated as soon as the browser is closed.

    Upgrade note for 2.0.0 from previous versions!

    Version 2.0.0 requires an update in the database schema, so that additionally the date of the last access / hit on the page can be displayed ($page->lastPageHit). To make this possible, you have to do the update via the upgrade module, upload the ZIP itself and do an update directly via the backend AND DO A MODULE REFRESH DIRECTLY AFTER UPLOAD/UPDATE. If you do not do this, you will get an error that a column is missing in the database table.

    >>>> All information about the changelog and bug fixings in the first post.

    • Like 2
  19. On 6/13/2020 at 3:37 PM, antpre said:

    Hello everyone,

    I realized that I might have not been precise enough with my question.

    I have a multi language web site. I have a template called document. I have 4 language : default (not used on the front end), french and english and spanish

    A page with that template can be either active  in french , in english, spanish or active in all of them. English in the not the default language though (it is the first additional language).

    My need is to have page hit counts views irrespective of the language. and stores views irrespective of the language. so if a page gets 1 view in english and 1 view in french. It would count 2 views.

    I tested my use case with Page hit module. I found that the views were properly recorded if the page was active english. But if the page is active in french or spanish the view is counted in the front end (on the debug consol it says 'Page Hit Counter: Tracked' but doesn't get recorded in the database.

    Why would it work for the first language that is not the default language and not with the other one. For the purpose of my test I duplicated the same page so only the language active status was changed. The change of url (from /fr to /en) is not the problem cause the page that has both language get the counts recorded from both the url language.

    I guess the module is not working in my use case even if I didn't need the recorded hits to be per se multilanguage.

    Unfortunately I cannot reproduce an issue here. I have used the module in several productive multilingual environments. No matter from which language version (even for me the default is not english) it is counted. Maybe you have "URL segments" in use? I have written an info about this in the readme. 

    A separate counter function for each language version is not planned. All hits are summed up, no matter from which language. Maybe in the future, when I have more time for it. Sorry.

×
×
  • Create New...