GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - wiedymi/swift-plausible: Swift SDK for the Plausible Analytics API: Stats API v2, Sites API, and Events API tracking for Apple platforms

BranchesTags
Open more actions menu

Latest commit

 

History

3 Commits
3 Commits

Folders and files

NameName
Last commit message
Last commit date
Sources
Sources
 
 
Tests/PlausibleTests
Tests/PlausibleTests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 
SPEC.md
SPEC.md
 
 

Repository files navigation

Plausible

GitHub Twitter Email Discord Support me

Swift SDK for the Plausible Analytics API, focused on Apple-platform dashboard apps and event tracking.

Use it to build native iOS/macOS analytics dashboards with the Stats API v2 and Sites API, with Events API ingestion included for pageviews and custom events.

Features

  • Apple-only Swift Package with Swift Concurrency-first API
  • Public import Plausible surface with split modules underneath:
    • PlausibleCore
    • PlausibleAPI
    • PlausibleTracker
  • Stats API v2 support:
    • typed metrics and dimensions
    • custom date ranges
    • simple, logical, behavioral, and segment filters
    • ordering, includes, and pagination
  • Sites API support:
    • sites and teams
    • shared links
    • goals
    • custom properties
    • guests
  • Tracker support:
    • pageviews
    • custom events and properties
    • revenue and non-interactive events
    • dropped-event detection
  • Raw API escape hatch for upstream routes not yet wrapped

Platforms

  • iOS 15+
  • macOS 12+
  • tvOS 15+
  • watchOS 8+
  • visionOS 1+
  • Swift tools 6.0+

Installation

Add to Package.swift:

dependencies: [
    .package(url: "https://github.com/wiedymi/swift-plausible.git", from: "0.1.0")
]

Then add the library target:

.target(
    name: "YourApp",
    dependencies: [
        .product(name: "Plausible", package: "swift-plausible")
    ]
)

Quick Start

Dashboard client

import Foundation
import Plausible

let configuration = PlausibleConfiguration(
    baseURL: URL(string: "https://plausible.io")!,
    userAgent: "MyDashboard/1.0"
)

let client = PlausibleAPIClient(
    configuration: configuration,
    auth: .apiKey("your-stats-api-key")
)

let response = try await client.stats.query(
    .init(
        siteID: "example.com",
        metrics: [.visitors, .pageviews, .bounceRate],
        dateRange: .last30Days,
        dimensions: [.timeDay],
        include: .init(timeLabels: true)
    )
)

for row in response.results {
    print(row.dimensions, row.metrics)
}

Tracker client

import Foundation
import Plausible

let tracker = PlausibleTrackerClient(domain: "example.com")

try await tracker.pageview(url: "https://example.com/pricing")

try await tracker.event(
    name: "Purchase",
    url: "https://example.com/checkout",
    props: ["plan": "team", "seats": 5],
    revenue: .init(currency: "USD", amount: Decimal(string: "99.00")!)
)

Development

swift build
swift test

Docs

  • SPEC.md - SDK scope and implementation plan
  • Plausible upstream source - optional reference, not included in package checkouts
  • Plausible Stats API
  • Plausible Sites API
  • Plausible Events API

Notes

  • baseURL defaults to https://plausible.io; set it to your self-hosted Plausible server origin when needed.
  • Stats and Sites requests use bearer API keys, while Events API requests are unauthenticated.
  • Plausible derives unique visitors from the User-Agent and client IP. Servers relaying app events should set EventRequest.forwardedFor to the end user's IP.
  • Set interactive: false on a custom event to exclude it from bounce-rate calculations.
  • API contracts were validated against the Plausible documentation on July 20, 2026, and the upstream commit pinned in SPEC.md.

License

MIT

About

Swift SDK for the Plausible Analytics API: Stats API v2, Sites API, and Events API tracking for Apple platforms

Topics

analyticsiosmacosplausibleswiftswift-package-manager

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.