npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@gamealytics/unity-sdk

v2.0.9

Published

Unity SDK for GameAlytics game analytics platform with simplified permission management

Readme

GameAnalytics Unity SDK

The official Unity SDK for GameAlytics, providing game analytics tracking for Unity games across multiple platforms.

Features

  • Cross-platform support: Works on all major Unity platforms (iOS, Android, Windows, macOS, Linux, WebGL, and consoles)
  • Easy integration: Simple API for tracking game events, errors, and in-app purchases
  • Real-time analytics: View your game's analytics in real-time on the GameAlytics dashboard
  • Comprehensive event tracking: Track custom events, errors, sessions, and more
  • Lightweight: Minimal performance impact on your game

Installation

Via Unity Package Manager

  1. Open Unity Package Manager (Window > Package Manager)
  2. Click the + button and select Add package from git URL
  3. Enter: https://github.com/gamealytics/gamealytics-sdk.git?path=/packages/unity

Usage

1. Initialize the SDK

using GameAlytics;

public class GameManager : MonoBehaviour
{
    void Start()
    {
        // Create user configuration
        var userConfig = UserConfig.CreateBuilder()
            .SetSessionId(System.Guid.NewGuid().ToString())
            .SetUserId("user123") // or use SetAnonymous() for anonymous users
            .Build();

        // Initialize GameAlytics
        GameAlytics.Init("your-api-key", Environment.PRODUCTION)
            .UserConfig(userConfig)
            .Create();
    }
}

2. Track System Events

// Track user events
GameAlytics.GetInstance().SystemEvent()
    .Category(typeof(GameAlytics.UserEvents))
    .Type(GameAlytics.UserEvents.SESSION_START)
    .SetProperties(new Dictionary<string, string> 
    {
        {"platform", "mobile"}
    })
    .Trigger();

// Track gameplay events
GameAlytics.GetInstance().SystemEvent()
    .Category(typeof(GameAlytics.GameplayEvents))
    .Type(GameAlytics.GameplayEvents.LEVEL_START)
    .SetProperties(new Dictionary<string, string>
    {
        {"level", "1"},
        {"difficulty", "easy"}
    })
    .Trigger();

// Track IAP events
GameAlytics.GetInstance().SystemEvent()
    .Category(typeof(GameAlytics.IAPEvents))
    .Type(GameAlytics.IAPEvents.PURCHASE)
    .SetProperties(new Dictionary<string, string>
    {
        {"item_id", "sword_001"},
        {"price", "4.99"},
        {"currency", "USD"}
    })
    .Trigger();

3. Track Custom Events

// Track custom events
GameAlytics.GetInstance().CustomEvent()
    .Category("boss_fight")
    .Type("boss_defeated")
    .SetProperties(new Dictionary<string, string>
    {
        {"boss_name", "Dragon King"},
        {"time_taken", "120"}
    })
    .Trigger();

4. Session Management

// Start a new session
GameAlytics.GetInstance().StartSession();

// End current session
GameAlytics.GetInstance().EndSession();

Event Categories

User Events

GameAlytics.UserEvents.SESSION_START
GameAlytics.UserEvents.SESSION_END
GameAlytics.UserEvents.USER_LOGIN
GameAlytics.UserEvents.USER_LOGOUT
GameAlytics.UserEvents.USER_REGISTER

Gameplay Events

GameAlytics.GameplayEvents.LEVEL_START
GameAlytics.GameplayEvents.LEVEL_END
GameAlytics.GameplayEvents.LEVEL_UP
GameAlytics.GameplayEvents.GAME_START
GameAlytics.GameplayEvents.GAME_END
GameAlytics.GameplayEvents.BOSS_FIGHT

Economy Events

GameAlytics.EconomyEvents.CURRENCY_EARNED
GameAlytics.EconomyEvents.CURRENCY_SPENT
GameAlytics.EconomyEvents.ITEM_PURCHASED
GameAlytics.EconomyEvents.ITEM_SOLD
GameAlytics.EconomyEvents.SHOP_VIEWED

| Event | Description | |-------|-------------| | OnInitialized | Triggered when the SDK is successfully initialized |

Best Practices

  1. Initialize early: Initialize the SDK as early as possible in your game's lifecycle
  2. Track meaningful events: Focus on events that provide actionable insights
  3. Use consistent naming: Use consistent event and parameter names across your game
  4. Test in development: Use the debug mode to verify events are being tracked correctly
  5. Respect privacy: Only collect data that's necessary for improving your game

Troubleshooting

Common Issues

  • Events not appearing in dashboard:

    • Verify your game key and secret key are correct
    • Check your internet connection
    • Make sure you're looking at the correct environment in the GameAlytics dashboard
  • SDK not initializing:

    • Check the Unity console for any error messages
    • Make sure you have the required permissions in your Android/iOS manifest

Debugging

Enable debug logging to see detailed information about SDK operations:

// Enable debug logging before initializing the SDK
GameAnalytics.SetDebugLogEnabled(true);
GameAnalytics.Initialize(gameKey, secretKey, Application.version);

Support

For support, please contact [email protected] or visit our documentation.

License

This SDK is licensed under the MIT License. See the LICENSE file for more information.