Goals

To track the effect that Chat agents have on improving sales or completing website based goals, you can set a URL-based goal (such as page views of a pricing page) that matches the URL exactly or contains a certain parameter in the URL.

Goals can be set up to capture conversions based on agent first-touch or last-touch attribution. The attribution period can be between 1 to 30 days.

Note: Accounts have a maximum limit of 5 active Goals. An error message Goals limit exceeded will appear if you try to exceed the active Goal limit.

JSON Format

Goals are represented as JSON objects with the following attributes.

Name Type Read-only Description
id integer yes The ID of the goal
name string no The name of the goal
description string no The description of the goal
enabled integer no Describes whether the goal is enabled
attribution_model string no Describes the attribution model associated with the goal. One of first_touch, last_touch
attribution_period integer no Describes the attribution period in days for this goal. Range between 1 to 30
settings object no The settings for the goal. Contains the conditions array (described below).
JSON Format for conditions

The settings attribute contains a conditions array. The conditions array contains objects which represent individual conditions to be matched. If any single condition is met, the goal is considered to be fulfilled. Each object has the following attributes.

Name Type Read-only Description
type string no Describes the type of condition. Currently supports only url
operator string no Describes the operator used to compare if a goal is fulfilled. One of equals, contains
value string no Describes the actual value to compare if a goal is fulfilled. If operator is specified as equals, should start with http:// or https://

Get All Goals

GET /api/v2/goals

This lists all the goals for your account.

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/goals \
  -v -u {email_address}:{password}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json

[
  {
    "id" : 1,
    "name" : "Goal 1",
    "description" : "A sample goal",
    "enabled" : 1,
    "attribution_model" : "first_touch",
    "attribution_period": 30,
    "settings" : {
      "conditions": [
        {
          "operator": "equals",
          "type": "url",
          "value": "http://cart.com/"
        },
        {
          "operator": "contains",
          "type": "url",
          "value": "cart"
        }
      ]
    }
  },
  {
    "id" : 2,
    "name" : "Goal 2",
    "description" : "A sample goal",
    "attribution_model" : "last_touch",
    "attribution_period": 15,
    "settings" : {
      "conditions": [
        {
          "operator": "equals",
          "type": "url",
          "value": "http://zopim.com/"
        },
        {
          "operator": "contains",
          "type": "url",
          "value": "zopim"
        }
      ]
    }
  }
]

Get Goal

GET /api/v2/goals/{goal_id}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/goals/{goal_id} \
  -v -u {email_address}:{password}
Example Response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id" : 1,
  "name" : "Goal 1",
  "description" : "A sample goal",
  "enabled" : 1,
  "attribution_model" : "first_touch",
  "attribution_period": 30,
  "settings" : {
    "conditions": [
      {
        "operator": "equals",
        "type": "url",
        "value": "http://cart.com/"
      },
      {
        "operator": "contains",
        "type": "url",
        "value": "cart"
      }
    ]
  }
}

Create Goal

POST /api/v2/goals

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/goals \
  -d '{
        "name" : "Goal 3",
        "description" : "A new goal",
        "enabled" : 1,
        "attribution_model" : "first_touch",
        "attribution_period": 15,
        "settings" : {
          "conditions": [
            {
              "operator": "equals",
              "type": "url",
              "value": "http://mysite.com/"
            }
          ]
        }
      }' \
  -v -u {email_address}:{password} \
  -X POST -H "Content-Type: application/json"
Example Response
HTTP/1.1 201 Created
Content-Type: application/json

{
  "id" : 3,
  "name" : "Goal 3",
  "description" : "A new goal",
  "enabled" : 1,
  "attribution_model" : "first_touch",
  "attribution_period": 15,
  "settings" : {
    "conditions": [
      {
        "operator": "equals",
        "type": "url",
        "value": "http://mysite.com/"
      }
    ]
  }
}

Update Goal

PUT /api/v2/goals/{goal_id}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/goals/3 \
  -d '{"name": "Good goal"}' \
  -v -u {email_address}:{password}
  -X PUT -H "Content-Type: application/json"
Example Response
HTTP/1.1 200 OK
Content-Type: application/json

{
  "id" : 3,
  "name" : "Good goal",
  "description" : "A new goal",
  "enabled" : 1,
  "attribution_model" : "first_touch",
  "attribution_period": 15,
  "settings" : {
    "conditions": [
      {
        "operator": "equals",
        "type": "url",
        "value": "http://mysite.com/"
      }
    ]
  }
}

Delete Goal

DELETE /api/v2/goals/{goal_id}

Allowed for
  • Owner
  • Administrator
Using cURL
curl https://www.zopim.com/api/v2/goals/3 \
  -v -u {email_address}:{password} -X DELETE
Response
Status: 204 No Content