Skip to content
This repository was archived by the owner on May 5, 2026. It is now read-only.
Benjamin Diolez edited this page May 5, 2026 · 1 revision

Data API / Reporting API v3 / Parameters / 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.

PARAMETER DESCRIPTION POSSIBLE VALUES
type Absolute (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.

PARAMETER DESCRIPTION POSSIBLE VALUES
type R (relative period), AP (Relative to the analysis period)
granularity Y(ear), Q(uarter), M(onth), W(eek), D(ay), MN(minute)
startOffset Number
endOffset Number

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.

  • JavaScript

  • Shell

  • Python

  • Ruby

// 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"
                        }
                    }
                }
            }
        }
    }

Wiki contents

Clone this wiki locally