openapi: 3.0.1
info:
  title: Event API
  description: This API can be used to send offline or server-side conversion data to FigPii. Use cases include tracking lead submissions or deal closures, server-side tracking for E-Commerce purchases, etc.
  version: 1.0.0
servers:
  - url: https://analytics-api.figpii.com
paths:
  /event:
    get:
      summary: Submit a conversion
      description: Track an event with necessary parameters and enqueue it for processing.
      operationId: trackEvent
      parameters:
        - name: access_token
          in: query
          description: Any requests missing an authentication token will be discarded and not tracked! Tokens are available on Large packages and can be generated by contacting our support team or emailing support@figpii.com
          required: true
          schema:
            type: string
        - name: event_name
          in: query
          description: Name of the event to track, i.e. purchase
          required: true
          schema:
            type: string
        - name: test_id
          in: query
          description: Each A/B Test has a unique visitor ID, refer to our guide for constructing experiment_strings for server-side tracking purposes on how to retrieve and store this data.
          required: true
          schema:
            type: integer
        - name: variation_id
          in: query
          description: Each Experiment ID will be paired with a variation ID, i.e. which variation of the Experiment did the visitor receive.
          required: true
          schema:
            type: integer
        - name: vid
          in: query
          description: Each visitor needs a unique ID we can refer to. You need to collect the FigPii Unique Visitor ID generated by our front-end tracker through our window API by calling  FIGPII.clientInfo.getVisitorId()
          required: true
          schema:
            type: string
        - name: analytics_id
          in: query
          description: Refer to our guide for constructing experiment_strings for server-side tracking purposes on how to retrieve your analytics ID. Your Analytics region is selected by you at the time of your registration. The default is EU (GDPR Compliant), and US is available as an option. Analytics ID can also be retrieved through our window API window.FIGPII.settings.analyticsId
          required: false
          schema:
            type: string
        - name: analytics_region
          in: query
          description: The region of the analytics (default is EU)
          required: false
          schema:
            type: string
        - name: revenue
          in: query
          description: The revenue value for the event
          required: false
          schema:
            type: number
            format: float
        - name: event_url
          in: query
          description: If the request happened on a webpage, include the encoded URI as event_url.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Event successfully tracked
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
        '400':
          description: Bad Request - Missing or invalid parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: missing {parameter_name}, please refer to https://kb.figpii.com/article/301-offline-tracking-api
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Try again in 60 seconds

components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
        error:
          type: string