“period” parameter: “H” v. “He” & “MN” v. “MNe”

 

Choose the context wisely

When requesting the API on specific time ranges (hours or minutes), it’s all about deciding whether you want either:

  • all the events from the visits that started during this time frame (“H” and “MN”), or
  • all the events that happened during this time range (“He” and “MNe”).

Luckily, the AT Internet Reporting API allows you to query both scenarios:

  • “H” and “He” helps you work on hours;
  • “MN” and “MNe” helps you work on minutes.

All the examples provided below work the same way with “MN” and “MNe”.

 

Focus on the start of the visit

Let’s take the case of this visit:

  • Started at 9.52am
  • Closed at 10.01am
  • 16 pages loaded
  • 12 before 10am
  • 4 after 10am


Now, let’s narrow the results down by using the “{H:2017-01-06T>09}” parameter: https://apirest.atinternet-solutions.com/data/v2/html/getData?&columns={d_visit_id,d_date_hour_event,d_page,m_page_loads}&sort={d_date_hour_event}&space={s:xxxxxx}&period={H:2017-01-06T09}

It returns all the events of the visits that started during the 9th hour. In our case, all the events of our visits are listed.

Let’s now use the “{H:2017-01-06T10}” parameter to get the events of the visits that happened during the 10th hour: https://apirest.atinternet-solutions.com/data/v2/html/getData?&columns={d_visit_id,d_date_hour_event,d_page,m_page_loads}&sort={d_date_hour_event}&space={s:xxxxxx}&period={H:2017-01-06T10}

In this case, none of the events of this visit will be returned as it didn’t start between 10am and 10.59am.

 

Focus on the events rather than on the visits

How can I retrieve the events that happened between 9am and 9.59am? You can use the “{He:2017-01-06T09}” parameter: https://apirest.atinternet-solutions.com/data/v2/html/getData?&columns={d_visit_id,d_date_hour_event,d_page,m_page_loads}&sort={d_date_hour_event}&space={s:xxxxxx}&period={He:2017-01-06T09}

All the events of the this visit that happened after 10am are not listed. If I need them, I can use the “{He:2017-01-06T10}” parameter: https://apirest.atinternet-solutions.com/data/v2/html/getData?&columns={d_visit_id,d_date_hour_event,d_page,m_page_loads}&sort={d_date_hour_event}&space={s:xxxxxx}&period={He:2017-01-06T10}

Even though the visit started at 9am, its events from 10am are correctly listed.

 

How does it work with segmented data sets?

Now, let’s imagine I want to segment on visits containing the page “gallery.php”:

  • {H:2017-01-06T09}: the context is all the visits that started between 9am and 9.59am and that contains the page “gallery.php”. The full visit will show up in the results:
  • {He:2017-01-06T09}: the context is all visits with “gallery.php” as an event between 9am and 9.59am. The visit will not show up in the results.
  • {H:2017-01-06T10}: the context is all the visits that started between 10am and 10.59am and that contains the page “gallery.php”. The visit will not show up in the results as it started between 9am and 9.59am.
  • {He:2017-01-06T10}: the context is all visits with “gallery.php” as an event between 10am and 10.59am. The 4 events of the visits will then show up in the results:
Was this post helpful?
Yes
No
Last update: 22/11/2017