openapi: 3.0.0
servers:
  - description: Redeal Analytics API
    url: https://analytics.redeal.io/api/1.0.0
info:
  contact:
    email: hello@redeal.io
  description: Access analytics for Redeal
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  title: Redeal Analytics API
  version: 1.0.0
  x-apisguru-categories:
    - analytics
  x-logo:
    url: https://static.redeal.se/APIDefinitions/re-deal-logo-cmyk_1.svg
  x-origin:
    - format: openapi
      url: https://static.redeal.se/APIDefinitions/analytics.redeal.io-1.0.0-swagger.yaml
      version: "3.0"
  x-providerName: redeal.io
  x-serviceName: analytics
tags:
  - description: Operations available to regular developers
    name: developers
paths:
  /events:
    get:
      description: |
        By passing in the company, site or deal Id a set of user interaction event records is returned. For pagination of a large result set use queryexecutionid and nexttoken instead.
      operationId: getEvents
      parameters:
        - description: pass an optional company Id
          in: query
          name: company
          required: false
          schema:
            type: string
        - description: pass an optional site Id
          in: query
          name: site
          required: false
          schema:
            type: string
        - description: pass an optional deal Id
          in: query
          name: deal
          required: false
          schema:
            type: string
        - description: type of records to return
          in: query
          name: type
          required: false
          schema:
            enum:
              - all
              - clicks
              - contacts
            type: string
        - description: next token to start returning records from
          in: query
          name: nexttoken
          required: false
          schema:
            type: string
        - description: id of execution to get more records based on next token
          in: query
          name: queryexecutionid
          required: false
          schema:
            type: string
      responses:
        "200":
          content:
            application/json:
              schema:
                items:
                  $ref: "#/components/schemas/EventRecord"
                type: array
          description: analytics results matching criteria
        "400":
          description: bad input parameter
      summary: get events for analytics
      tags:
        - developers
components:
  schemas:
    EventRecord:
      properties:
        agent:
          example: Mozilla/5.0 (iPhone; CPU iPhone OS 14_4_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.0.3 Mobile/15E148 Safari/604.1
          type: string
        browsertype:
          example: Chrome
          type: string
        channel:
          example: Whatsapp
          type: string
        click:
          example: Minimize
          type: string
        clicks:
          example: 1
          type: integer
        code:
          example: null
          type: string
        company:
          example: a89d82faf093c43c9c28659d
          type: string
        contact:
          example: MailChimp
          type: string
        cost:
          example: 1.1
          type: number
        costcurrency:
          example: EUR
          type: string
        currency:
          example: EUR
          type: string
        deal:
          example: afe76fe60defa9000288e4ff
          type: string
        deal name:
          example: My deal
          type: string
        delay:
          example: 473
          type: integer
        denyreason:
          example: Deal is expired
          type: string
        device:
          example: a75984d7a1d1a4379
          type: string
        devicetype:
          example: Mobile
          type: string
        email:
          example: a89d82faf093c43c9c28659d
          type: string
        emailaddrsha256:
          example: cc63f389e0957aeacc9db39b8a0c2e7792aae3eb76af8909d30d9eab1f7309ac
          type: string
        flow:
          example: afe76fe60defa9000288e4ff
          type: string
        flowstep:
          example: FriendImpression
          type: string
        flowtype:
          example: Start
          type: string
        impression:
          example: Widget
          type: string
        ip:
          example: 0.0.0.0
          type: string
        latitude:
          example: 51.4353
          type: string
        longitude:
          example: -0.3096
          type: string
        optin:
          example: Redeal
          type: string
        os:
          example: iOS
          type: string
        resolution:
          example: 360x760
          type: string
        revenue:
          example: 10.5
          type: number
        role:
          example: Ambassador
          type: string
        session:
          example: a909d7aff093c4423ccee7cc
          type: string
        site:
          example: a909d7aff093c4423ccee7cc
          type: string
        site name:
          example: My site
          type: string
        timestamp:
          example: 2016-08-29T09:12:33.001Z
          format: date-time
          type: string
        total:
          example: 12.6
          type: number
        user:
          example: a909d7aff093c4423ccee7cc
          type: string
        userlanguage:
          example: de-DE
          type: string
      required:
        - timestamp
        - role
        - flow
        - deal
        - click
        - channel
        - impression
        - user
        - device
        - flowstep
        - latitude
        - longitude
        - devicetype
        - resolution
        - os
        - userlanguage
        - browsertype
        - revenue
        - total
        - denyreason
        - session
        - optin
        - site
        - contact
        - code
        - currency
        - company
        - email
        - emailaddrsha256
        - agent
        - flowtype
        - ip
        - delay
        - site name
        - deal name
        - clicks
        - cost
        - costcurrency
      type: object
