tag-manager icon indicating copy to clipboard operation
tag-manager copied to clipboard

Start and end date for Tags uses UTC time for all timezones

Open Starker3 opened this issue 1 year ago • 6 comments

We had a user that was having issues when configuring a tag with a specific start date and end date.

While investigating this issue, I found that the Start and End time for a Tag that is stored in UTC will be treated as that time in any timezone and not be converted to that visitors timezone.

For example, if we create a Tag such as the following: Thursday-14-07-2022 11-24-15 In the above example the start date is set as 1 AM July 14 NZST with end date 8 PM July 14 NZST When this is converted to UTC, the start date is 1 PM July 13 UTC with end date 8 AM July 14 UTC

When we then test this tag in the browser, the tag does not fire with the following in the logs: Thursday-14-07-2022 11-24-28 not firing as this tag does not match date However, the time of my device when testing was 11:20 AM NZST or 11:20PM UTC

When I changed the End Date of the tag to one day further (8 PM July 15 NZST, 8 AM July 15 UTC), it fired correctly as it detected the End Date time had not occurred yet:

Thursday-14-07-2022 11-26-01

This indicates that the time for the start/end date is converted to UTC but is used in the browser as the local timezone of the browser.

Starker3 avatar Jul 13 '22 23:07 Starker3

@Starker3 I have checked earlier versions too before VUE migration and its not a regression, we convert and store in UTC and post that we check if the visitor current time is in between the converted start and end datetime

@tsteur Just confirming this is how it is supposed to be right ?

AltamashShaikh avatar Jul 14 '22 07:07 AltamashShaikh

@AltamashShaikh I think this behavior has been the same since it was implemented. But the way it works currently would basically mean the tag would fire for some visitors some of the time.

Starker3 avatar Jul 14 '22 07:07 Starker3

@Starker3 Yes, its the same may be we should convert the visitors local time to UTC to do the comparison and it will be consistent for everyone, as currently the tag will fire/not fire depending upon visitors timezone and it will give a wrong impression on data.

AltamashShaikh avatar Jul 15 '22 02:07 AltamashShaikh

@AltamashShaikh Do we know yet if this issue is going to be worked on?

Starker3 avatar Aug 04 '22 20:08 Starker3

@Starker3 We haven't yet prioritised it to be done. If you have other users waiting for this it would be good to let us know in this issue also

justinvelluppillai avatar Aug 04 '22 21:08 justinvelluppillai

@justinvelluppillai We currently just have the one user that reported this issue waiting on a fix. But with what the issue is, it likely impacts every user that makes use of this feature in the tag manager. But with how it is currently, they might not realise it until they look more closely at the data and investigate why some actions are tracked before & after the dates & times set in the tag manager.

Starker3 avatar Aug 04 '22 21:08 Starker3

@Starker3 Should be fixed with release of Matomo 4.12, we will convert the user datetime to UTC during visit and check if its in the specified period defined and fire accordingly.

AltamashShaikh avatar Aug 22 '22 03:08 AltamashShaikh

Thanks @AltamashShaikh !

Starker3 avatar Aug 22 '22 03:08 Starker3