CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-posthog

Integrate PostHog into any python application.

89

1.03x
Overview
Eval results
Files

task.mdevals/scenario-3/

B2B Analytics Tracker

Build a B2B analytics tracker that manages organization and team-level analytics for a SaaS application.

Requirements

Your tracker should support tracking multiple types of groups (organizations and teams) with their properties. The system should:

  1. Initialize the analytics client with proper configuration
  2. Set organization-level properties such as company name, subscription tier, and employee count
  3. Set team-level properties such as team name, department, and member count
  4. Support updating group properties when information changes (calling identify again with new properties)

Implementation Details

Create a module with three functions:

  • A function to initialize the analytics system with an API key
  • A function to set or update organization properties given an organization ID
  • A function to set or update team properties given a team ID

Test Cases

  • Initialize the analytics client with a valid API key @test
  • Set properties for an organization with ID 'org_123' (name: 'Acme Corp', tier: 'starter', employee_count: 25) @test
  • Set properties for a team with ID 'team_456' (name: 'Engineering', department: 'Product', member_count: 8) @test
  • Update organization 'org_123' properties (tier: 'enterprise', employee_count: 50) @test

Dependencies { .dependencies }

posthog { .dependency }

Provides analytics and tracking capabilities for B2B applications.

@generates

API

def initialize_analytics(api_key: str, host: str = None) -> None:
    """
    Initialize the analytics system with the provided API key.

    Args:
        api_key: The PostHog project API key
        host: Optional custom host URL
    """
    pass


def set_organization_properties(org_id: str, properties: dict) -> None:
    """
    Set or update properties for an organization.

    Args:
        org_id: Unique identifier for the organization
        properties: Dictionary of organization properties (e.g., name, tier, employee_count)
    """
    pass


def set_team_properties(team_id: str, properties: dict) -> None:
    """
    Set or update properties for a team.

    Args:
        team_id: Unique identifier for the team
        properties: Dictionary of team properties (e.g., name, department, member_count)
    """
    pass

Install with Tessl CLI

npx tessl i tessl/pypi-posthog

tile.json