Period

 

Foreword

See Postman example

p1 object is mandatory, it is the main period of analysis.

p2 object is optional, it describes the comparison period.

PARAMETERDESCRIPTIONPOSSIBLE VALUES
typeAbsolute (Day format) or R(elative): D(ay), M(onth), H(our)
 

Absolute periods

Date format: yyyy-mm-dd

// Querying absolute periods:
"period": {
  "p1": [
    {
      "type": "D",
      "start": "2019-10-20",
      "end": "2019-10-24"
    }
  ],
  "p2": [
    {
      "type": "D",
      "start": "2019-10-15",
      "end": "2019-10-19"
    }
  ]
}

# Querying absolute periods:
"period": {
  "p1": [
    {
      "type": "D",
      "start": "2019-10-20",
      "end": "2019-10-24"
    }
  ],
  "p2": [
    {
      "type": "D",
      "start": "2019-10-15",
      "end": "2019-10-19"
    }
  ]
}

# Querying absolute periods:
"period": {
  "p1": [
    {
      "type": "D",
      "start": "2019-10-20",
      "end": "2019-10-24"
    }
  ],
  "p2": [
    {
      "type": "D",
      "start": "2019-10-15",
      "end": "2019-10-19"
    }
  ]
}

# Querying absolute periods:
"period": {
  "p1": [
    {
      "type": "D",
      "start": "2019-10-20",
      "end": "2019-10-24"
    }
  ],
  "p2": [
    {
      "type": "D",
      "start": "2019-10-15",
      "end": "2019-10-19"
    }
  ]
}

 

Relative periods

In the case of a single site call, the relative period will be in relation to the time zone of the site. In the case of a multi-site call, the relative period will be in relation to the most easterly time zone of the requested sites.

If you call a site A (UTC-1) and a site B (UTC+2), then the relative period will be relative to the site B.

PARAMETERDESCRIPTIONPOSSIBLE VALUES
typeR (relative period), AP (Relative to the analysis period)
granularityY(ear), Q(uarter), M(onth), W(eek), D(ay), MN(minute)
startOffsetNumber
endOffsetNumber

The periods relative to the analysis date are only applied to the visitor/user segments.
The periods of type AP will adapt to the analysis date, we take as example the following call which has :

  • An analysis period of type R which will give us a date in relation to the current date which will be for the following example 01-04-2021 so we will have as a result for the first period the date of the previous month which is from 01-03-2021 until 31-03-2021.
  • Another date of type AP for the segment which will adapt to the date of analysis which represents for our example the month of March thus for the period of the segment we will have as result the date of 01-02-2021 until 28-02-2021.

// Querying relative periods:
"period": {
        "p1": [
            {
                "type": "R",
                "granularity": "M",
                "startOffset": -1,    
                "endOffset": -1
            }
        ]
    },
    "space": {
        "s": [
            608209
        ]
    },
    "columns": [
        "visit_src",
        "m_visits"
    ],
    "page-num": 1,
    "max-results": 10,
    "sort": [
        "-m_visits"
    ],
    "segment": {
        "section": {
            "mode": "include",
            "scope": "visitor_id",
            "period": {
                "p1": [
                    {
                        "type": "AP",
                        "granularity": "M",
                        "startOffset": -1,
                        "endOffset": -1
                    }
                ]
            },
            "content": {
                "condition": {
                    "filter": {
                        "visit_geo_country": {
                            "$eq": "France"
                        }
                    }
                }
            }
        }
    }

# Querying relativeperiods:
"period": {
        "p1": [
            {
                "type": "R",
                "granularity": "M",
                "startOffset": -1,    
                "endOffset": -1
            }
        ]
    },
    "space": {
        "s": [
            608209
        ]
    },
    "columns": [
        "visit_src",
        "m_visits"
    ],
    "page-num": 1,
    "max-results": 10,
    "sort": [
        "-m_visits"
    ],
    "segment": {
        "section": {
            "mode": "include",
            "scope": "visitor_id",
            "period": {
                "p1": [
                    {
                        "type": "AP",
                        "granularity": "M",
                        "startOffset": -1,
                        "endOffset": -1
                    }
                ]
            },
            "content": {
                "condition": {
                    "filter": {
                        "visit_geo_country": {
                            "$eq": "France"
                        }
                    }
                }
            }
        }
    }

# Querying relativeperiods:
"period": {
        "p1": [
            {
                "type": "R",
                "granularity": "M",
                "startOffset": -1,    
                "endOffset": -1
            }
        ]
    },
    "space": {
        "s": [
            608209
        ]
    },
    "columns": [
        "visit_src",
        "m_visits"
    ],
    "page-num": 1,
    "max-results": 10,
    "sort": [
        "-m_visits"
    ],
    "segment": {
        "section": {
            "mode": "include",
            "scope": "visitor_id",
            "period": {
                "p1": [
                    {
                        "type": "AP",
                        "granularity": "M",
                        "startOffset": -1,
                        "endOffset": -1
                    }
                ]
            },
            "content": {
                "condition": {
                    "filter": {
                        "visit_geo_country": {
                            "$eq": "France"
                        }
                    }
                }
            }
        }
    }

# Querying relativeperiods:
"period": {
        "p1": [
            {
                "type": "R",
                "granularity": "M",
                "startOffset": -1,    
                "endOffset": -1
            }
        ]
    },
    "space": {
        "s": [
            608209
        ]
    },
    "columns": [
        "visit_src",
        "m_visits"
    ],
    "page-num": 1,
    "max-results": 10,
    "sort": [
        "-m_visits"
    ],
    "segment": {
        "section": {
            "mode": "include",
            "scope": "visitor_id",
            "period": {
                "p1": [
                    {
                        "type": "AP",
                        "granularity": "M",
                        "startOffset": -1,
                        "endOffset": -1
                    }
                ]
            },
            "content": {
                "condition": {
                    "filter": {
                        "visit_geo_country": {
                            "$eq": "France"
                        }
                    }
                }
            }
        }
    }