GitHub

GitHub analytics integration guide

Overview

GitHub analytics are collected through GitHub’s REST API v3. This integration allows you to track repository metrics, traffic data, and release download statistics for your GitHub repositories and releases.

Available Metrics

Repository Stars - Number of users who starred your repository
Repository Forks - Number of times your repository has been forked
Watchers - Number of users watching your repository
Subscribers - Number of users subscribed to notifications
Open Issues - Current number of open issues
Repository Views - Traffic views (requires repo access)
Repository Clones - Git clone operations (requires repo access)
Unique Views/Clones - Unique visitors/cloners (requires repo access)
Release Downloads - Download counts for release assets
Commits (Last Year) - Commit activity over the past year

Traffic Data Requirements

⚠️ Important: Repository traffic data (views and clones) requires push access or higher to the repository. This means:

  • For your own repositories: Full access with repo scope
  • For organization repositories: You need to be a collaborator with push access
  • Public repository stars/forks: Available with public_repo scope

Authentication

GitHub requires a Personal Access Token (PAT) for API access. Two types are available:

  • More granular permissions available
  • Can be limited to specific repositories
  • Repository permissions needed: Contents (read), Metadata (read)
  • For traffic data: Repository permissions need to include administration or push access

Personal Access Token (Classic)

  • Scope for public repositories: public_repo
  • Scope for private repositories or traffic data: repo (full repository access)
  • Scope for releases only: public_repo (if releases are public)

Supported URL Formats

The GitHub adapter recognizes these URL patterns:

  • https://github.com/owner/repository - Repository analytics
  • https://github.com/owner/repository/releases - Latest release analytics
  • https://github.com/owner/repository/releases/tag/v1.0.0 - Specific tagged release
  • https://github.com/owner/repository/releases/123456 - Release by ID

The integration automatically handles rate limiting with appropriate retry mechanisms.

Setting Up GitHub Analytics

Step 1: Create a Personal Access Token

  1. Go to GitHub Settings → Developer settings → Personal access tokens
  2. Click “Fine-grained tokens” → “Generate new token”
  3. Give it a descriptive name like “ContentCompass Analytics”
  4. Set an appropriate expiration date (90 days recommended)
  5. Select repository access based on your needs:
  6. Permissions - GitHub require administative permission to provide access to the metrics ContentCompass collects. Make the permissions Read Only
  7. Click “Generate token”
  8. Important: Copy the token immediately - you won’t see it again!

Step 2: Add Credentials in ContentCompass

  1. Navigate to Credentials in ContentCompass
  2. Click “New Credential”
  3. Select “GitHub” as the platform
  4. Authentication type will auto-select to “API Key”
  5. Paste your Personal Access Token in the “Personal Access Token” field
  6. Give your credential a memorable name
  7. Optionally share with your team if working collaboratively
  8. Click “Create Credential”

Step 3: Add GitHub URLs to Your Ideas

  1. When editing an idea, add your GitHub repository or release URL to the “Published Link” field
  2. ContentCompass will automatically detect it’s a GitHub URL and begin collecting analytics
  3. Analytics collection happens in the background and may take a few minutes

Missing traffic data

  • Traffic data requires push access or higher to the repository
  • Only repositories you own or collaborate on will show view/clone data
  • Public repositories will still show stars, forks, and other public metrics

Rate limiting

  • GitHub enforces rate limits on API requests
  • ContentCompass automatically retries after rate limit periods

Best Practices

  1. Use descriptive token names to track which tokens are used where errors
  2. Keep tokens secure - never share them or commit them to code repositories

Privacy and Security

  • Tokens are only used to fetch analytics data, never to modify repositories
  • Consider using fine-grained tokens limited to specific repositories for additional security
  • Regularly rotate tokens as part of good security hygiene

Future Updates

This integration will be updated as GitHub releases new API endpoints or metrics. Current integration uses GitHub REST API v3.

Ready to put this into practice?

Start your free 14-day trial and experience ContentCompass for yourself.