We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    Here is my idea, let me know if this would work.

    Right now un-logged-in users are assigned to the anonymous group. Would it mess-up things to use a cookie to create a user profile and assign them to multiple groups? I would like to create multiple user groups as defined user segments made up of various characteristics (for example "Sci-Fi Movie Fans" or "Football Fans from Texas"). Then use a snippet or plugin to update the profile as they move from page to page. If they visit the "Football" section and their IP is from Texas add them to that user group. If the anonymous user fills out a form with an email address then update the profile with the email address then you can use it with other snippets to email users from that group. Or show content on the home page based on user group.

    This would be a very powerful tool. It seems like the best idea is to leverage the existing structure built in to user groups. How many users could it handle? If a site gets 200,000 unique visits a month would that be a problem?
      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.
      • 38290
      • 712 Posts
      Would it mess-up things to use a cookie to create a user profile and assign them to multiple groups?

      It sounds to me like your idea, is very sound. I wouldn't say I'm "the person" to ask the most scalable way to implement something like that but I'm sure this post will stumble upon those that are in no time.

      The most traditional way to accomplish something like this is to have users sign up and create an account on the site of course. It sounds like you are trying to accomplish similar features, but without the signup process.

      Ok as I'm typing I had an idea from MODXpo. Bert Oost gave a demonstration on extending modUser. He showed an example of a data model he did for a dating wesite. Was very impressive. So maybe the direction you need to be headed is extending anonymous instance of modUser and maybe storing data in a custom table of some kind.

      It looks like there is an Extending modUser post on RTFM
      http://rtfm.modx.com/revolution/2.x/developing-in-modx/advanced-development/extending-moduser

      Now as much as I try to stay away from using JavaScript for, well anything I have to ask if it is crucial for their to be a data model on the server side? If your areas of custom content on the site were essentially widgets loaded over AJAX you could use html5 localstorage to store information in the users browsers, and pass those parameters back to the server in your requests.

      I've done something similar on my site to create a favoriting feature that allows users to star posts and visit /favorites to see their "bookmarks" if you will.
        jpdevries
        • 38290
        • 712 Posts
        Another thought... one thing you may need to ask yourself is without a sign up process how long does your session data survive? If you are using anonymous site sessions rather than users, I believe all that data would be lost whenever you flush the Sessions of the site (something that is a good idea to do periodically to keep the table from growing outrageously large).
          jpdevries
          • 4385
          • 372 Posts
          I would not want the user to create an account, but keep the data in the db.

          Plus we can use snippets like Notify or MemberCheck

          Another example use... Someone searches on the site for FPS games or is browsing and reads details about FPS games. Now we add that data to their profile. Next week they come to the site and enter our big giveaway contest and using their email address, which we use to update their profile. Now we have a real person. The following week Call of Duty 7 is released, we can email the FPS user group that we have 50 copies of the latest game right now.

            DropboxUploader -- Upload files to a Dropbox account.
            DIG -- Dynamic Image Generator
            gus -- Google URL Shortener
            makeQR -- Uses google chart api to make QR codes.
            MODxTweeter -- Update your twitter status on publish.
            • 38290
            • 712 Posts
            How are you capturing their email address?
              jpdevries
              • 4385
              • 372 Posts
              Quote from: dinocorn at Nov 19, 2013, 10:14 PM
              How are you capturing their email address?

              Enter a contest, download a whitepaper, or a contact form. Better yet, by clicking a link in a targeted email.
                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                What about privacy laws? Wouldn't you have to notify the user in some way that you are storing his browsing data? Would you respect browser "do not follow" settings?
                  Studying MODX in the desert - http://sottwell.com
                  Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                  Join the Slack Community - http://modx.org
                  • 3749
                  • 24,544 Posts
                  I've been working on a package that extends the modUser object (or any other MODX object) for you automatically. All you have to do is add the fields you want to the existing schema and it does the rest, including creating the DB table and registering the classes in the extension_packages System Setting so they'll be loaded on every request.

                  Who knows when it will be finished, but it might be useful for something like this.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                    • 38290
                    • 712 Posts
                    Quote from: sottwell at Nov 19, 2013, 10:38 PM
                    What about privacy laws? Wouldn't you have to notify the user in some way that you are storing his browsing data? Would you respect browser "do not follow" settings?

                    Good points. There are various laws about capturing email addresses and providing unsubscribe options.

                    Is the anything specific about the account creation process that turns you away?
                      jpdevries
                      • 4385
                      • 372 Posts
                      Quote from: sottwell at Nov 19, 2013, 10:38 PM
                      What about privacy laws? Wouldn't you have to notify the user in some way that you are storing his browsing data? Would you respect browser "do not follow" settings?

                      Those concerns are usually addressed in the privacy section of the web site.
                      For example read the one below on the MODX site.

                      Also all email must conform to the rules of the CAN-SPAM act (http://en.wikipedia.org/wiki/CAN-SPAM_Act_of_2003).
                        DropboxUploader -- Upload files to a Dropbox account.
                        DIG -- Dynamic Image Generator
                        gus -- Google URL Shortener
                        makeQR -- Uses google chart api to make QR codes.
                        MODxTweeter -- Update your twitter status on publish.