Feature

App Attribution

Register your AI applications to track usage, earn revenue share, and get discovered

What is App Attribution?

App Attribution allows you to register your applications with ParrotRouter to track usage, participate in revenue sharing programs, and showcase your apps in our marketplace. Get insights into how your apps use AI models and earn rewards for driving usage.

App Registration

Register and verify your applications

Usage Analytics

Track detailed usage across all models

Revenue Sharing

Earn up to 20% revenue share

Registering Your App

Register your application to start tracking usage and earning rewards:

App Registrationpython
import requests

# Register your application
response = requests.post(
    "https://api.parrotrouter.com/v1/apps",
    headers={
        "Authorization": "Bearer your-api-key",
        "Content-Type": "application/json"
    },
    json={
        "name": "AI Writing Assistant",
        "description": "Professional writing assistant powered by AI",
        "category": "productivity",
        "website": "https://writingassistant.ai",
        "logo_url": "https://writingassistant.ai/logo.png",
        "metadata": {
            "platform": ["web", "ios", "android"],
            "launch_date": "2024-01-15",
            "team_size": 5,
            "target_audience": "business_professionals"
        },
        "features": [
            "content_generation",
            "grammar_checking",
            "style_improvement",
            "translation"
        ],
        "models_used": [
            "gpt-4-turbo-preview",
            "gpt-3.5-turbo",
            "claude-3-opus"
        ],
        "revenue_share": {
            "enabled": True,
            "tier": "standard",  # standard: 10%, premium: 15%, enterprise: 20%
            "payout_method": "monthly_credit"  # or "bank_transfer"
        },
        "attribution": {
            "public_profile": True,
            "show_in_marketplace": True,
            "allow_reviews": True
        }
    }
)

app_data = response.json()
print(f"App ID: {app_data['app_id']}")
print(f"App Key: {app_data['app_key']}")
print(f"Dashboard URL: {app_data['dashboard_url']}")

# Verify app ownership
verification = requests.post(
    f"https://api.parrotrouter.com/v1/apps/{app_data['app_id']}/verify",
    headers={"Authorization": "Bearer your-api-key"},
    json={
        "method": "dns",  # or "file", "meta_tag"
        "record": f"parrotrouter-verify={app_data['verification_code']}"
    }
)

print(f"Verification status: {verification.json()['status']}")

Attribution Headers

Include attribution headers in your API requests to track usage:

Basic Attribution

from openai import OpenAI

client = OpenAI(
    base_url="https://api.parrotrouter.com/v1",
    api_key="your-api-key",
    default_headers={
        "X-App-ID": "app_abc123",
        "X-App-Key": "ak_xyz789"  # Optional: for enhanced tracking
    }
)

# All requests will be attributed to your app
response = client.chat.completions.create(
    model="gpt-4-turbo-preview",
    messages=[{"role": "user", "content": "Write a blog post"}],
    extra_headers={
        "X-User-ID": "user_123",  # Track individual users
        "X-Session-ID": "session_456",  # Track sessions
        "X-Feature": "blog_writer"  # Track feature usage
    }
)

Advanced Attribution

# Detailed attribution with metadata
response = client.chat.completions.create(
    model="gpt-4-turbo-preview",
    messages=[{"role": "user", "content": "Generate marketing copy"}],
    extra_headers={
        "X-App-ID": "app_abc123",
        "X-Attribution": json.dumps({
            "user": {
                "id": "user_123",
                "plan": "premium",
                "signup_date": "2024-01-01",
                "lifetime_value": 499.00
            },
            "session": {
                "id": "session_789",
                "duration": 1234,
                "page_views": 15
            },
            "feature": {
                "name": "marketing_copy",
                "version": "2.0",
                "ab_test": "variant_b"
            },
            "context": {
                "platform": "web",
                "browser": "chrome",
                "country": "US",
                "referrer": "google"
            }
        })
    }
)

# Track conversion events
conversion = requests.post(
    "https://api.parrotrouter.com/v1/apps/events",
    headers={"Authorization": "Bearer your-app-key"},
    json={
        "app_id": "app_abc123",
        "event_type": "conversion",
        "user_id": "user_123",
        "value": 29.99,
        "currency": "USD",
        "metadata": {
            "plan": "premium",
            "attribution_source": "ai_generated_content"
        }
    }
)

Usage Analytics

Access detailed analytics about your app's AI usage:

App Analyticspython
# Get app analytics
analytics = requests.get(
    f"https://api.parrotrouter.com/v1/apps/{app_id}/analytics",
    headers={"Authorization": "Bearer your-api-key"},
    params={
        "period": "30d",
        "granularity": "day"
    }
).json()

print(f"Total requests: {analytics['total_requests']}")
print(f"Unique users: {analytics['unique_users']}")
print(f"Total cost: $" + str(analytics['total_cost']))
print(f"Revenue share earned: $" + str(analytics['revenue_share']))

# Model usage breakdown
print("\nModel Usage:")
for model in analytics['models']:
    print(f"  {model['name']}:")
    print(f"    Requests: {model['requests']}")
    print(f"    Cost: $" + str(model['cost']))
    print(f"    Avg tokens: {model['avg_tokens']}")

# Feature usage
print("\nFeature Usage:")
for feature in analytics['features']:
    print(f"  {feature['name']}: {feature['usage_count']} uses")

# User segments
print("\nUser Segments:")
for segment in analytics['segments']:
    print(f"  {segment['name']}: {segment['users']} users ($" + str(segment['revenue']) + ")")

# Geographic distribution
print("\nGeographic Distribution:")
for country in analytics['countries'][:5]:
    print(f"  {country['name']}: {country['percentage']}%")

# Export detailed reports
report = requests.post(
    f"https://api.parrotrouter.com/v1/apps/{app_id}/reports",
    headers={"Authorization": "Bearer your-api-key"},
    json={
        "type": "detailed_usage",
        "period": "last_month",
        "format": "csv",  # or "json", "excel"
        "include": [
            "user_cohorts",
            "feature_adoption",
            "model_performance",
            "cost_analysis"
        ]
    }
)

Revenue Sharing

Revenue Share Tiers

Starter Tier

10% Revenue Share

Default tier for all verified apps. Monthly usage: $0 - $10,000

Growth Tier

15% Revenue Share

For apps driving significant usage. Monthly usage: $10,000 - $50,000

Scale Tier

20% Revenue Share

Premium tier for high-volume apps. Monthly usage: $50,000+

Revenue Tracking

# Get revenue share details
revenue = requests.get(
    f"https://api.parrotrouter.com/v1/apps/{app_id}/revenue",
    headers={"Authorization": "Bearer your-api-key"},
    params={"period": "2024-01"}
).json()

print(f"Current tier: {revenue['tier']}")
print(f"Revenue share rate: {revenue['rate']}%")
print(f"Total usage: $" + str(revenue['total_usage']))
print(f"Revenue earned: $" + str(revenue['earned']))
print(f"Pending payout: $" + str(revenue['pending_payout']))
print(f"Next payout date: {revenue['next_payout_date']}")

# Historical payouts
print("\nPayout History:")
for payout in revenue['payouts']:
    print(f"  {payout['date']}: $" + str(payout['amount']) + f" ({payout['status']})")

# Revenue projections
projections = requests.get(
    f"https://api.parrotrouter.com/v1/apps/{app_id}/revenue/projections",
    headers={"Authorization": "Bearer your-api-key"}
).json()

print(f"\nProjected revenue (next 30 days): $" + str(projections['next_30_days']))
print(f"Growth rate: {projections['growth_rate']}%")
print(f"Tier upgrade eligible in: {projections['days_to_next_tier']} days")

App Marketplace

Showcase your app in the ParrotRouter marketplace:

Marketplace Listingpython
# Update marketplace listing
listing = requests.put(
    f"https://api.parrotrouter.com/v1/apps/{app_id}/marketplace",
    headers={"Authorization": "Bearer your-api-key"},
    json={
        "listing": {
            "title": "AI Writing Assistant Pro",
            "tagline": "Write better content 10x faster with AI",
            "description": "Our AI Writing Assistant helps professionals create high-quality content in minutes. Features include: Blog post generation, Email templates, Social media content, SEO optimization, 25+ languages supported",
            "screenshots": [
                "https://writingassistant.ai/screenshots/dashboard.png",
                "https://writingassistant.ai/screenshots/editor.png",
                "https://writingassistant.ai/screenshots/results.png"
            ],
            "video_url": "https://youtube.com/watch?v=demo",
            "categories": ["productivity", "writing", "business"],
            "tags": ["ai-writer", "content-creation", "seo", "multilingual"],
            "pricing": {
                "model": "freemium",
                "free_tier": "10 documents/month",
                "paid_tiers": [
                    {"name": "Pro", "price": "$29/month", "features": "Unlimited docs"},
                    {"name": "Team", "price": "$99/month", "features": "5 users + API"}
                ]
            },
            "integration_guides": [
                {
                    "title": "Quick Start Guide",
                    "url": "https://docs.writingassistant.ai/quickstart"
                },
                {
                    "title": "API Documentation",
                    "url": "https://docs.writingassistant.ai/api"
                }
            ]
        },
        "badges": {
            "verified": True,
            "top_rated": True,
            "editors_choice": False,
            "trending": True
        },
        "social_proof": {
            "testimonials": [
                {
                    "author": "Sarah Chen",
                    "role": "Content Manager",
                    "company": "TechCorp",
                    "text": "This app saved us 20 hours per week on content creation!"
                }
            ],
            "stats": {
                "users": 50000,
                "documents_created": 1000000,
                "time_saved_hours": 500000
            }
        }
    }
)

# Get marketplace performance
performance = requests.get(
    f"https://api.parrotrouter.com/v1/apps/{app_id}/marketplace/stats",
    headers={"Authorization": "Bearer your-api-key"}
).json()

print(f"Marketplace views: {performance['views']}")
print(f"Click-through rate: {performance['ctr']}%")
print(f"Conversion rate: {performance['conversion_rate']}%")
print(f"Average rating: {performance['rating']}/5 ({performance['reviews']} reviews)")
print(f"Marketplace rank: #{performance['rank']} in {performance['category']}")

User Attribution

Track individual user journeys and optimize their experience:

User Trackingpython
# Track user lifecycle
class UserTracker:
    def __init__(self, app_id, api_key):
        self.app_id = app_id
        self.api_key = api_key
        self.client = OpenAI(
            base_url="https://api.parrotrouter.com/v1",
            api_key=api_key
        )
    
    def track_user_signup(self, user_id, metadata):
        requests.post(
            "https://api.parrotrouter.com/v1/apps/events",
            headers={"Authorization": f"Bearer {self.api_key}"},
            json={
                "app_id": self.app_id,
                "event": "user_signup",
                "user_id": user_id,
                "metadata": metadata
            }
        )
    
    def track_feature_usage(self, user_id, feature, value=None):
        return self.client.chat.completions.create(
            model="gpt-4-turbo-preview",
            messages=[{"role": "user", "content": "..."}],
            extra_headers={
                "X-App-ID": self.app_id,
                "X-User-ID": user_id,
                "X-Feature": feature,
                "X-Feature-Value": str(value) if value else None
            }
        )
    
    def get_user_analytics(self, user_id):
        return requests.get(
            f"https://api.parrotrouter.com/v1/apps/{self.app_id}/users/{user_id}",
            headers={"Authorization": f"Bearer {self.api_key}"}
        ).json()

# Usage
tracker = UserTracker("app_abc123", "your-api-key")

# Track signup
tracker.track_user_signup("user_123", {
    "plan": "free",
    "source": "organic",
    "referrer": "blog_post"
})

# Track feature usage with AI request
response = tracker.track_feature_usage(
    "user_123", 
    "blog_writer", 
    {"word_count": 1000}
)

# Get user insights
insights = tracker.get_user_analytics("user_123")
print(f"User lifetime value: $" + str(insights['ltv']))
print(f"Features used: {insights['features_used']}")
print(f"Retention probability: {insights['retention_probability']}%")

Best Practices

  • 1.
    Always Include Attribution Headers

    Include app ID in every request for accurate tracking

  • 2.
    Track User Segments

    Understanding user behavior helps optimize AI usage

  • 3.
    Monitor Feature Adoption

    Track which features drive the most AI usage

  • 4.
    Optimize for Revenue Share

    Focus on high-value users to maximize earnings

Related Features