-
Notifications
You must be signed in to change notification settings - Fork 63
Conversation
@An-dz Sorry for the delay, we're going to review this ASAP! |
By the way, it still lacks the react hooks to control some of the features through React. |
Any movement on this? 😬 |
Just waiting for a green light this is what's expected then I'll finish it. |
Sorry for the delay on this. I'll be available next week to take a look! |
Hi @An-dz Sorry it took so long! We looked into your pull-request, however we do believe there are some issues regarding this solution that we tbh, in retrospect, could've also seen coming when opening issue #178.
I think we should make method available that can communicate directly with I'm curious what your opinion is on this. |
For that reason I would change the interface to this: instance
.urlBase('https://LINK.TO.DOMAIN')
.scriptPath('/js/matomo.js')
.push('setSiteId', 3)
.push('setUserId', 'example_id')
.push('disableCookies')
.push('setSecureCookie', true)
.push('setRequestMethod', 'POST');
const MatomoInstance = new window.MatomoTracker
.default('https://localhost')
.setSiteId(3)
MatomoInstance.initialize()
// some code to get id
MatomoInstance.setUserId(uuid) // you can chain more stuff here too |
I would prefer if such methods would be optional to use. For example I'm passing to MatomoTracker whole configuration object which is read from env file on build: const matomo = new MatomoTracker(__MATOMO_OPTIONS__) I don't have to check for optional configuration properties when some are available in ie. staging but not production const matomo = new MatomoTracker(__MATOMO_OPTIONS__.urlBase)
matomo
.setSiteId(__MATOMO_OPTIONS__.siteId)
if (___MATOMO_OPTIONS__.srcUrl !== undefined) {
matomo.setSrcUrl(__MATOMO_OPTIONS__.srcUrl)
} I mean fluent API is cool, but not for configurations. |
It wouldn't be a problem to implement a |
@An-dz Plus you wouldn't introduce a breaking change in API |
@piotr-cz I would, cause many of them are exactly problem number 1 @chrisvanmook mentioned. For example: |
77458b8
to
b56ca50
Compare
I am going to close this PR for now. We're looking to introduce a new API design in the future, once the core team agrees on a strategy. |
Here's a first commit for implementing #176
Needs a lot of more testing, I guess it also allows #106
Todo