LogSnag Docs
Home
  • ⚡Welcome
  • Quick Start
  • LogSnag for SaaS
  • ⚒️SDKs
    • Node
    • React
    • Next
    • Vue
    • Deno
    • Web
    • Python
  • 📖API Reference
    • Log
    • Identify
    • Insight
    • Insight Mutate
  • 🧳Tools
    • Feedback Widget
  • 🤝Integrations
    • Zapier
    • Bubble
    • Unofficial
Powered by GitBook
On this page
  • Installation
  • Usage

Was this helpful?

  1. SDKs

Python

Installation

pip3 install logsnag

Usage

Import Library

from logsnag import LogSnag

Initialize Client

logsnag = LogSnag(token='7f568d735724351757637b1dbf108e5', project="my-saas")

Track Event

logsnag.track(
    channel="payments",
    event="New Subscription",
    user_id="user-123",
    icon="💰",
    notify=True,
    tags={
        "plan": "premium",
        "cycle": "monthly",
        "trial": False
    }
)

User Properties

logsnag.identify(
    user_id="user_123",
    properties={
        "name": "John Doe",
        "email": "john@doe.com",
        "plan": "free",
    }
)

Publish Insight

logsnag.insight.track(
    title='User Count',
    value=100,
    icon='👨',
)

Increment Insight

logsnag.insight.increment(
    title='User Count',
    value=1,
    icon='👨',
)
PreviousWebNextLog

Last updated 1 year ago

Was this helpful?

⚒️