Closed tsteur closed 3 years ago
@tsteur I have a question about this. I have a solution where I store the events (when it was closed, it was shared or not, etc) in the browser's localstorage. For sure it's not the perfect solution, if a user changing browsers or using incognito mode it won't work.
Do you have any other recommendation? Like storing for the user in db?
Thanks
Hi @flamisz
be great to store this in the backend instead of in the browser so it won't appear every time they go incognito etc.
I was going to suggest we use the UsersManager.setUserPreference
API see https://github.com/matomo-org/matomo/blob/4.1.0/plugins/UsersManager/API.php#L194 but it's not really a preference so better not to use it.
There is a plugin_settings
table which can store plugin related settings for each user (see example usage here https://github.com/matomo-org/matomo/blob/4.1.0/plugins/CorePluginsAdmin/Model/TagManagerTeaser.php#L44-L58 where it was used for a similar feature) but it's kind of the same thing... it's not really a setting and this backend was basically built for this feature https://developer.matomo.org/guides/plugin-settings and we'd probably end up using the API not quite in the intended way.
I would actually for now simply store it in the option table similar to https://github.com/matomo-org/matomo/blob/4.1.0/plugins/Feedback/Feedback.php#L80-L93 and https://github.com/matomo-org/matomo/blob/4.1.0/plugins/Feedback/Controller.php#L37-L47
Compared to this example where it also uses the Option
class it be great though to put the logic for setting and getting this value into a separate class like Piwik\Plugins\Feedback\ReviewReminder
. When developing the linked FeedbackReminder
logic above should have also put it in a separate class.
Does this help? I think that feedback reminder is quite a similar logic where we'd also need a controller method to update the value etc. It might help to check how the logic for that updateFeedbackReminderDate
controller method works. Let me know if some information is missing
@flamisz fyi just created this new doc https://github.com/matomo-org/developer-documentation/blob/d70f5907d5f59f7bfc0744a002094af0cad7d5cb/docs/4.x/user-in-depth.md as part of https://github.com/matomo-org/developer-documentation/pull/427/files where I'm trying to summarise some thoughts on this. Once merged, it will be available under https://developer.matomo.org/guides/user-in-depth
Thanks @tsteur very helpful indeed. I will implement this way and let you know if I have further questions.
As I mentioned in #17581, "When someone clicks on the X icon on the right then we don't show it for another 6 months." should be "never", not "6 months".
Not sure into which plugin to put this best. However, it needs to be disabled by WhiteLabel (eg through some event).
We'd basically show a block in the bottom similar to on our demo.matomo.cloud (might need to go incognito to see it)
(be great to give the social icons some white background or something so they stand out) "Refer Matomo" is basically a "mailto" link that add's following subject:
subject:
message body:
The user can then customise the email in their email program and enter email addresses etc.
For social sharing we would use this text if possible:
can we have buttons for twitter, facebook, linkedin and mastodon? We would not actually load their JS etc but use the share links like https://www.facebook.com/sharer.php and https://twitter.com/intent/tweet and https://www.linkedin.com/shareArticle/ . Not sure it's possible for mastodon?
After clicking on any of the links and the desired action was initiated could we maybe show a thank you modal dialog saying like
Thank you for spreading the word and creating a safer web
?X
icon on the right then we don't show it for another 6 months.