Expand my Community achievements bar.

Join us for the next Community Q&A Coffee Break on Tuesday April 23, 2024 with Eric Matisoff, Principal Evangelist, Analytics & Data Science, who will join us to discuss all the big news and announcements from Summit 2024!
SOLVED

How to set Time Parting in buckets of 30 minutes or 1 hour?

Avatar

Level 2

Hi all,

I've started recently to use Adobe Analytics with DTM, and I just implemented the Time Parting  3.4 plug-in. Right now I have the time & day of the week being collect into evars, but the time is at minute level (example: 11:25). I would like to capture these value in buckets of 30 minutes or 1 hour. I think there are two ways of doing this, correct? By using classifications or by configure the plugin it self. Can someone please share how to achieve this?

Thanks.

Carlos

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

i personally prefer to use classification, just because you din't loose any information and you can change the interval later on if you want.

to achieve the buckets on the time evar you need to setup classification: Classifications

and then use regex to extract the desired information

regex for hour bucket: "^([^:]+):" => $1

(regex extracts the hour number, eg "13" for "13:25")

if you want a bucket for half an hour i do not have a quick solution with regex. might be that this is not possible in a simple way, means you need a few rules to match all cases ...

hope that helps, regards urs

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

i personally prefer to use classification, just because you din't loose any information and you can change the interval later on if you want.

to achieve the buckets on the time evar you need to setup classification: Classifications

and then use regex to extract the desired information

regex for hour bucket: "^([^:]+):" => $1

(regex extracts the hour number, eg "13" for "13:25")

if you want a bucket for half an hour i do not have a quick solution with regex. might be that this is not possible in a simple way, means you need a few rules to match all cases ...

hope that helps, regards urs

Avatar

Level 2

Thanks for your reply. And do you know how to do it without classifications? I would like to know both choices

Tks

Avatar

Community Advisor

as already said i wouldn't use any changes on JS-side, because you loose information if you want to change the buckets later on. as written on getTimeParting  it is recommended to use the classifications.

if you want to do it with javascript, you just need to change the string bevor setting the variable. eg if you want an hour granularity, you just need to change character 3+4 to "00" or delete them, gives you either "3:00 AM|Monday" instead of "3:27 AM|Monday"

BTW: if the returning steing contains "AM", you need to change the regex in my first answer, maybe split it up into two rules ...