> ## Documentation Index
> Fetch the complete documentation index at: https://developers.partoo.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Profile metrics for your business

> This endpoint lets you view the **Google Business Profile** analytics for all your businesses subscribed to
**Presence Management**.
The API allows you to select what data you're interested in, and how you want it aggregated (daily, monthly,
by business, etc). You can also filter the results to limit it to a certain date range, and to certain business.

Google Business Profile doesn't provide reliable data for the most recent 5 days.

You can choose the analytics you want to get among:
- impressions: desktop maps impressions, mobile maps impressions, desktop search impressions, and mobile search impressions
- actions: website link clicks, phone calls, and driving directions

You can use the following filters:
- by businesses (businesses id in list or not in list)
- by date (analytics before and/or after a date)
- by business query. Will return matches for the business name, zipcode or city
- by business city.

The response can be aggregated by:
- business id
- by date: either by day, week, month or year
- by both business id and date

The response can be ordered in ascending or descending order by any of the selected dimensions or metrics.
See examples for more details.




## OpenAPI

````yaml /assets/openapi/openapi-bundled.yaml get /presence_analytics/metrics
openapi: 3.1.0
info:
  title: Partoo Rest API
  version: v2
  license:
    name: © Copyright Partoo
    url: https://www.partoo.co/en/gtu-api/
  x-logo:
    url: >-
      https://partoo-client-images.s3.amazonaws.com/logo-partoo-restapi-white.png
  description: >
    ## Introduction

    The Partoo Rest API allows you to automate all the actions that are possible
    to do in the Partoo Web Application.


    The Partoo Rest API can be used for many different purposes:
      - Create/update/delete your businesses & users if you are a client.
      - Create/subscribe/manage organizations, businesses & users if you are a reseller.
      - Retrieve data on businesses you have access to if you are a publisher.
      - ...
servers:
  - url: https://api.partoo.co/v2
    description: Production server
  - url: https://api.sandbox.partoo.co/v2
    description: Sandbox server (dev environment for clients & partners)
security:
  - ApiKeyAuth: []
paths:
  /presence_analytics/metrics:
    get:
      tags:
        - Presence analytics
      summary: Profile metrics for your business
      description: >
        This endpoint lets you view the **Google Business Profile** analytics
        for all your businesses subscribed to

        **Presence Management**.

        The API allows you to select what data you're interested in, and how you
        want it aggregated (daily, monthly,

        by business, etc). You can also filter the results to limit it to a
        certain date range, and to certain business.


        Google Business Profile doesn't provide reliable data for the most
        recent 5 days.


        You can choose the analytics you want to get among:

        - impressions: desktop maps impressions, mobile maps impressions,
        desktop search impressions, and mobile search impressions

        - actions: website link clicks, phone calls, and driving directions


        You can use the following filters:

        - by businesses (businesses id in list or not in list)

        - by date (analytics before and/or after a date)

        - by business query. Will return matches for the business name, zipcode
        or city

        - by business city.


        The response can be aggregated by:

        - business id

        - by date: either by day, week, month or year

        - by both business id and date


        The response can be ordered in ascending or descending order by any of
        the selected dimensions or metrics.

        See examples for more details.
      operationId: getPresenceAnalyticsMetrics
      parameters:
        - $ref: '#/components/parameters/query_metrics_presence'
        - $ref: '#/components/parameters/query_dimensions_presence'
        - $ref: '#/components/parameters/query_order_by_presence'
        - $ref: '#/components/parameters/pa_metrics_query_business__in'
        - $ref: '#/components/parameters/pa_metrics_query_business__notin'
        - $ref: '#/components/parameters/pa_metrics_query_city'
        - $ref: '#/components/parameters/pa_metrics_query_query'
        - $ref: '#/components/parameters/pa_metrics_query_filter_date__gte'
        - $ref: '#/components/parameters/pa_metrics_query_filter_date__lte'
        - $ref: '#/components/parameters/pa_pagination_query_page'
        - $ref: '#/components/parameters/pa_pagination_query_per_page'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PresenceAnalyticsMetricsResponse'
              examples:
                metrics=business_impressions_desktop_maps,business_impressions_desktop_search,business_impressions_mobile_maps,business_impressions_mobile_search,business_direction_requests,call_clicks,website_clicks:
                  value:
                    page: 1
                    count: 1
                    max_page: 1
                    metrics:
                      - business_impressions_desktop_maps: 123
                        business_impressions_desktop_search: 123
                        business_impressions_mobile_maps: 123
                        business_impressions_mobile_search: 123
                        business_direction_requests: 123
                        call_clicks: 123
                        website_clicks: 123
                dimensions=business & metrics=call_clicks:
                  value:
                    page: 1
                    count: 3
                    max_page: 1
                    metrics:
                      - call_clicks: 103
                        business_id: 59b2645db12ff60643ef832c
                      - call_clicks: 165
                        business_id: 60b2645fb12ff60643ef8344
                      - call_clicks: 28
                        business_id: 70b2645eb12ff60643ef833c
                dimensions=month & metrics=website_clicks & order_by=website_clicks:
                  value:
                    page: 1
                    count: 2
                    max_page: 1
                    metrics:
                      - website_clicks: 57
                        date: '2019-08-01'
                        bucket: month
                      - website_clicks: 79
                        date: '2019-09-01'
                        bucket: month
                dimensions=day,business & metrics=call_clicks & order_by=-day:
                  value:
                    page: 1
                    count: 6
                    max_page: 1
                    metrics:
                      - call_clicks: 48
                        business_id: 59b2645db12ff60643ef832c
                        date: '2019-09-30'
                        bucket: day
                      - call_clicks: 6
                        business_id: 59b2645fb12ff60643ef8344
                        date: '2019-09-30'
                        bucket: day
                      - call_clicks: 11
                        business_id: 59b2645db12ff60643ef832c
                        date: '2019-09-29'
                        bucket: day
                      - call_clicks: 0
                        business_id: 59b2645fb12ff60643ef8344
                        date: '2019-09-29'
                        bucket: day
                      - call_clicks: 2
                        business_id: 59b2645db12ff60643ef832c
                        date: '2019-09-28'
                        bucket: day
                      - call_clicks: 66
                        business_id: 59b2645fb12ff60643ef8344
                        date: '2019-09-28'
                        bucket: day
                dimensions=week & metrics=website_clicks & filter_date__gte=2019-09-15 & filter_date__lte=2019-09-16:
                  value:
                    page: 1
                    count: 2
                    max_page: 1
                    metrics:
                      - website_clicks: 32
                        date: '2019-09-09'
                        bucket: week
                      - website_clicks: 164
                        date: '2019-09-16'
                        bucket: week
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
      deprecated: false
components:
  parameters:
    query_metrics_presence:
      in: query
      name: metrics
      required: true
      description: |
        List of analytics to return.
         At least one in that list.
      schema:
        type: string
        enum:
          - business_impressions_desktop_maps
          - business_impressions_desktop_search
          - business_impressions_mobile_maps
          - business_impressions_mobile_search
          - business_direction_requests
          - call_clicks
          - website_clicks
    query_dimensions_presence:
      in: query
      name: dimensions
      required: false
      description: >
        How the returned data will be aggregated.

        At most 'business' and one time dimensions of the list.

        If no dimension is given, the request will return the sum of each metric
        for all requested days and businesses.
      schema:
        type: string
        enum:
          - business
          - day
          - week
          - month
          - year
    query_order_by_presence:
      in: query
      name: order_by
      required: false
      description: >
        Where the object is either a dimension or a metric and is used in the
        request. At most one in the list. - before a field to order_by DESC,
        nothing for ASC
      schema:
        type: string
        enum:
          - <object>
          - '-<object>'
        example: order_by=-call_clicks
    pa_metrics_query_business__in:
      in: query
      name: business__in
      description: Filter by business ids
      required: false
      schema:
        type: array
        items:
          $ref: '#/components/schemas/BusinessID'
    pa_metrics_query_business__notin:
      in: query
      name: business__notin
      required: false
      description: >
        Filter by all allowed businesses except the ones given in
        `business__notin`
      schema:
        type: array
        items:
          $ref: '#/components/schemas/BusinessID'
    pa_metrics_query_city:
      in: query
      name: city
      schema:
        type: string
      required: false
      description: Filter by city
    pa_metrics_query_query:
      in: query
      name: query
      required: false
      description: |
        Parameter to fuzzy search businesses on city, zipcode and name
      schema:
        type: string
    pa_metrics_query_filter_date__gte:
      in: query
      name: filter_date__gte
      required: false
      description: |
        Filter by `date`

        Return all the analytics whose `date` >= `given_date`.
      schema:
        type: string
        format: datetime
    pa_metrics_query_filter_date__lte:
      in: query
      name: filter_date__lte
      description: |
        Filter by `date`.

        Return all the analytics whose `filter_date` <= `given_date`.
      schema:
        type: string
        format: datetime
    pa_pagination_query_page:
      in: query
      name: page
      required: false
      description: |
        The page number you want to request.
      schema:
        type: integer
        default: 1
        minimum: 1
    pa_pagination_query_per_page:
      in: query
      name: per_page
      required: false
      description: |
        The maximum number of result items to return in a page.

        The value defaults to 500, when it is not included.
      schema:
        type: integer
        maximum: 500
  schemas:
    PresenceAnalyticsMetricsResponse:
      type: object
      properties:
        page:
          $ref: '#/components/schemas/Page'
        count:
          $ref: '#/components/schemas/TotalItemsCount'
        max_page:
          $ref: '#/components/schemas/MaxPage'
        metrics:
          $ref: '#/components/schemas/PresenceAnalyticsMetricsResults'
    BusinessID:
      description: Business id
      type: string
      example: 5409c35a97bbc544d8e26737
    Page:
      description: The current page number.
      type: integer
      example: 1
    TotalItemsCount:
      description: >
        Total number of results available for the filters and dimensions
        requested.
      type: integer
      example: 1
    MaxPage:
      description: Total number of pages available for this request.
      type: integer
      example: 1
    PresenceAnalyticsMetricsResults:
      type: array
      items:
        type: object
        properties:
          business_impressions_desktop_maps:
            $ref: '#/components/schemas/BusinessImpressionsDesktopMaps'
          business_impressions_mobile_maps:
            $ref: '#/components/schemas/BusinessImpressionsMobileMaps'
          business_impressions_desktop_search:
            $ref: '#/components/schemas/BusinessImpressionsDesktopSearch'
          business_impressions_mobile_search:
            $ref: '#/components/schemas/BusinessImpressionsMobileSearch'
          business_direction_requests:
            $ref: '#/components/schemas/BusinessDirectionRequests'
          call_clicks:
            $ref: '#/components/schemas/ActionsPhone'
          website_clicks:
            $ref: '#/components/schemas/ActionsWebsite'
          date:
            $ref: '#/components/schemas/AnalyticsDate'
          bucket:
            $ref: '#/components/schemas/AnalyticsBucket'
          business_id:
            $ref: '#/components/schemas/BusinessID'
    BusinessImpressionsDesktopMaps:
      type: integer
      description: |
        Business impressions on Google Maps on Desktop devices.
         Multiple impressions by a unique user within a single day are
         counted as a single impression.
      example: 123
    BusinessImpressionsMobileMaps:
      type: integer
      description: |
        Business impressions on Google Maps on Mobile devices.
         Multiple impressions by a unique user within a single
          day are counted as a single impression.
      example: 123
    BusinessImpressionsDesktopSearch:
      type: integer
      description: |
        Business impressions on Google Search on Desktop devices.
         Multiple impressions by a unique user within a single day
         are counted as a single impression.
      example: 123
    BusinessImpressionsMobileSearch:
      type: integer
      description: |
        Business impressions on Google Search on Mobile devices.
         Multiple impressions by a unique user within a single day
         are counted as a single impression.
      example: 123
    BusinessDirectionRequests:
      type: integer
      description: |
        The number of times a direction request was requested to the
         business location.
      example: 123
    ActionsPhone:
      type: integer
      description: Customers who call your business
      example: 123
    ActionsWebsite:
      type: integer
      description: Customers who click on your website link
      example: 123
    AnalyticsDate:
      type: string
      description: First day of the aggregation
      example: '2019-11-05'
    AnalyticsBucket:
      type: string
      description: Time aggregation requested
      example: day
  responses:
    '401':
      description: You are not authenticated
      content:
        application/json:
          schema:
            description: Error that occurs when you are not authenticated
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authentication:
                    type: string
                    default: User not authenticated
    '403':
      description: |
        You are not allowed to perform this action
      content:
        application/json:
          schema:
            description: >
              Error that occurs when you are authenticated but you are trying to
              perform an action you are not allowed to perform
            type: object
            properties:
              errors:
                type: object
                description: The detail of the error encountered
                properties:
                  authorization:
                    type: string
                    default: Operation not allowed
  securitySchemes:
    ApiKeyAuth:
      description: >
        The authentication system on Partoo API is using API Key that should be
        put in the header of the request (the name of the header is `x-APIKey`).
        An api_key is linked to a user. This user's role will give you different
        access level to the API features.
      type: apiKey
      in: header
      name: x-APIKey

````