Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I use customTrackingParameters to override the default cdt time format? #360

Closed
Isaacwhyuenac opened this issue Nov 11, 2020 · 11 comments · Fixed by #368
Closed

Can I use customTrackingParameters to override the default cdt time format? #360

Isaacwhyuenac opened this issue Nov 11, 2020 · 11 comments · Fixed by #368
Labels

Comments

@Isaacwhyuenac
Copy link

Hi, I would like to ask if I can pass a cdt in customTrackingParameters to override the default cdt value (ISO8601) value of the tracker? I would want to override it because I want it to be in unix timestamp (13 digits).

@brototyp
Copy link
Member

Hi @Isaacwhyuenac, I think that should work.

Out of curiosity: Why do you want to use a unix timestamp instead of the current ISO8601 format?

@Isaacwhyuenac
Copy link
Author

@brototyp thanks for the reply. But it looks like it is not working because there would have two cdt key in the final url string. One in iso8601 and one in unix time stamp.

Want this feature because we have some tracking events that fire together in some mini seconds difference. It would help to visualise and order the user’s journey more fully.

@brototyp
Copy link
Member

Oh, your are correct. Currently, there is no way to replace the value of a parameter. You can only add some.

I think your use case actually is one that the SDK should handle per default. I'll implement a fix for it.

@brototyp
Copy link
Member

Fixed and merged. This will be in the next release.

@Isaacwhyuenac
Copy link
Author

Isaacwhyuenac commented Dec 13, 2020

Thank you for the reply, but your changes are somehow not what I am expecting, which is to make cdt value unix timestamp (something like 1607875978284).

@brototyp
Copy link
Member

Thank you for the reply, but your changes are somehow not what I am expecting, which is to make cdt value unix timestamp (something like 1607875978284).

That's true. The cdt parameter is still a ISO8601 timestamp, but now it does contain milliseconds. Is that sufficient, or is there a reason to have the unix timestamp specifically?

@Isaacwhyuenac
Copy link
Author

Because our data pipeline use unix timestamp specifically 🤣, but also the matomo documentation somewhat allows us to use unix timestamp too. Just wondering if here can somehow allow user to override the default params format on every request, using something like JavaScript Array.reduce function. I am not a Swift developer, so I don't know if Swift can do this or is here the correct place to allow my desired behavior. Hope I have made my case clear.

Some matomo implementation, like in obj-c and js use unix timestamp. Java, for example, use iso8601 but allows overriding. So somewhat I am hoping an alignment of matomo sdk.

@brototyp
Copy link
Member

brototyp commented Jan 3, 2021

Hi @Isaacwhyuenac, I see. I think it would be a good idea to be able to override some parameters with exactly the ones you like to use. There is the risk in accidentally overriding some, but I think that can be mitigated a bit by documentation.

@brototyp
Copy link
Member

brototyp commented Jan 3, 2021

Hey @Isaacwhyuenac, can you try out this PR: #370. That should work fine now.

@Isaacwhyuenac
Copy link
Author

Isaacwhyuenac commented Jan 3, 2021

@brototyp It seems working fine. Thanks

@brototyp
Copy link
Member

brototyp commented Oct 3, 2021

This is now implemented and part of the latest release, v7.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants