I need some direction in how to store (complex) data into users (best practice)

I'm working on a project for a fitness app. I created a structure with 2 levels for workouts where level 1 entries are skills and level 2 entries progressions for these skills, in the progressions I made a matrix containing a content field for an exercise, a table for data such as sets and reps and some practical information.

Now here is how it should work:

The user starts a workout, a workout contains 4 or more exercises to complete for the workout to be finished. Now when every set of an exercise is done, the user has to fill in a number of repetitions he/she did for every set. When the workout finishes I would like to save all this data in the user (Or should i make a section for this?)

The data looks something like this:

    "skillID": {
    }, etc

This data is important, the next time this user is logging in and starting a workout I want to retrieve this data to give the user overview of how he/she is progressing, so like comparing the workout data with the user data. Plus it should be some kind of history too. Here it gets a bit to complicated for me, but I want to learn this! My thoughts were this:

Option 1: I create a section, here I create user data entries (so they are related with the user who create them) I store the data somehow on these entries, with tables or something Option 2: I store 2 JSON models into the user (if possible), 1 for writing and overwriting the progress of each workout (when doing the same workout it overwrites the existing data) and 1 for the history, were every date of doing a workout is a key and the value is the whole workout data provided by the users input.

What is the best way to go?

  • Kevon, did you ever choose a path for this functionality and do you have any recommendations now that you've had a go at it? We're evaluating Craft as a potential platform for an upcoming project, and we have very similar needs!
    – Keith
    Commented Mar 1, 2019 at 22:51
  • 1
    Hi Keith, sorry for the late comment but i was working on *real work projects so i didn't got the time to procceed on this! But, I needed the same thing and went for the JSON option stored on the users custom field! So for my app i'm going to take the same approach, I maybe want to share the data with other applications so JSON was my best choice! And what can I say, if you go with Craft you will be happy on how everything works! It's just AMAZING :) Good luck!
    – Kevon
    Commented Mar 6, 2019 at 15:52

2 Answers 2


There are a whole bunch of ways to do what you want to do.

You can add custom fields to user accounts. If you wanted to go with option 2 then you could create a custom text field and write the JSON into that.

Another way would be to add a Matrix field to the user accounts and write a new row for each workout.

And another way would be to create a new channel for Workouts. When a user completes a workout, a new entry is created and related to them. You can then retrieve entries relating to that user to display their workout history.

And yet another way, would be to create a custom model for a Workout and relate it to the user account. Your plugin would then create records using that model and you could retrieve them to display the user's progress.


I'm in a VERY similar situation .... my reputation is too low to comment so had to add as answer - I hope that isn't a problem.

Our system interacts with a 3rd party web app. Records are created in the 3rd party app and we need to keep references to them in Craft. Each record is tied to a USER. For each record we need to store the relevant recordId and JSON data in Craft. There will be 100+ records for each user and each record will contain roughly 50KB of data.

I'm debating which of the following suggestions from foamcow's answer is better. Specifically I was debating:

1) store in matrix field: create a matrix field (two fields = recordId; json) and assign this to the user; create a new 'block' each time a new record needs to be store;


2) store in Entries create a new Entry (section type = Channel?); create a new entry each time a record needs to be stored

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.