jonkoops / matomo-tracker

Stand alone library for using matamo tracking in frontend projects
Mozilla Public License 2.0
141 stars 62 forks source link

Why different param names? #563

Open SassNinja opened 3 years ago

SassNinja commented 3 years ago

This is mostly a question (might end up in an improvement though)

In the course of my previous PR #562 I've noticed the params are named different than in the official matomo docs https://developer.matomo.org/api-reference/tracking-javascript

For example the action trackEcommerceOrder where matomo calls the 2nd param grandTotal whereas your integration calls it orderRevenue https://github.com/Amsterdam/matomo-tracker/blob/master/packages/js/src/MatomoTracker.ts#L241

@chrisvanmook is there a particular reason for this discrepancy? Has matomo changed those names?

If not I'd suggest to name it identically to the official docs to avoid any confusion and unnecessary mapping.

chrisvanmook commented 3 years ago

@SassNinja Honestly, I have no idea why this is called orderRevenue. @lennart I believe you added this change, I can't find any documentation on orderRevenue either. Do you have any idea?

lennart commented 3 years ago

Matomo Ecommerce Analytics documentation as linked to in the comment (anchor link has changed, obviously) calls it revenue (not orderRevenue as I called it...). So yes, there is a discrepancy between this implementation, the Matomo docs and the Matomo API docs. As @SassNinja suggests, it seems to be best to use the naming from the API docs (grandTotal) and maybe also file a ticket upstream to consolidate/update the Matomo (api)docs.

The other params would then have to be (re)named accordingly (discount, tax etc.).

The reason I linked to the "docs" is the explanation of expected types/values for those params as the API docs are not clear about this (i.e. discount is either boolean, int or float).

The reason I named those params differently may have been to explain the assumed usage/types through them. When I review this now, they don't really make sense...so feel free to adjust them.

lennart commented 3 years ago

regarding documentation inconsistencies, I just filed tickets upstream.