Goals
Get Goals
Returns a paginated list of goals with their conversion metrics.
GET /api/sites/:site/goalsReturns a paginated list of goals with their conversion metrics.
Path Parameters
Prop
Type
Query Parameters
Accepts all Common Parameters plus the following:
Prop
Type
Response
Prop
Type
Goal Object
Prop
Type
GoalConfig Object
Prop
Type
curl -X GET "https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31" \
-H "Authorization: Bearer your_api_key_here"const response = await fetch(
'https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31',
{
headers: {
'Authorization': 'Bearer your_api_key_here'
}
}
);
const data = await response.json();import requests
response = requests.get(
'https://app.rybbit.io/api/sites/1/goals23',
params={
'start_date': '2024-01-01',
'end_date': '2024-01-31'
},
headers={
'Authorization': 'Bearer your_api_key_here'
}
)
data = response.json()<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer your_api_key_here'
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
?>require 'net/http'
require 'json'
require 'uri'
uri = URI('https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31')
req = Net::HTTP::Get.new(uri)
req['Authorization'] = 'Bearer your_api_key_here'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(req)
end
data = JSON.parse(res.body)package main
import (
"encoding/json"
"io"
"net/http"
)
func main() {
url := "https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer your_api_key_here")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
var data map[string]interface{}
json.Unmarshal(body, &data)
}use reqwest;
use serde_json::Value;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let response = client
.get("https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31")
.header("Authorization", "Bearer your_api_key_here")
.send()
.await?;
let data: Value = response.json().await?;
Ok(())
}import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31"))
.header("Authorization", "Bearer your_api_key_here")
.GET()
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
String data = response.body();
}
}using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer your_api_key_here");
var response = await client.GetAsync(
"https://app.rybbit.io/api/sites/1/goals?start_date=2024-01-01&end_date=2024-01-31");
var data = await response.Content.ReadAsStringAsync();
}
}{
"data": [
{
"goalId": 1,
"name": "Signup Completed",
"goalType": "path",
"config": {
"pathPattern": "/signup/complete"
},
"createdAt": "2024-01-10T12:00:00.000Z",
"total_conversions": 1250,
"total_sessions": 15420,
"conversion_rate": 0.081
},
{
"goalId": 2,
"name": "Purchase Made",
"goalType": "event",
"config": {
"eventName": "purchase",
"eventPropertyKey": "value",
"eventPropertyValue": 100
},
"createdAt": "2024-01-15T09:30:00.000Z",
"total_conversions": 320,
"total_sessions": 15420,
"conversion_rate": 0.021
}
],
"meta": {
"total": 2,
"page": 1,
"pageSize": 10,
"totalPages": 1
}
}