LethalAnalytics
Allows mod creators to see how their mods are used, easily catch errors, and learn about their audience. Supports Google Analytics!
截圖 共 8 張
模組介紹 作者原文
LethalAnalytics
Allows mod creators to see how their mods are used, easily catch errors, and learn about their audience.
This is a mod library or dependency. If you're playing with this mod installed, check out its LethalConfig for more info.
Dependencies
| Required | Name | Version |
|:--------:|:-------------|:------|
| ✅ | LethalConfig | 1.4.2 |
| ✅ | BepInExPack | 5.4.2100 |
Overview
- Supported Analytics Sites
- Usage
- Setting up
- Creating a GA session
- Sending GA events
- Creating a README note
- Creating a GA4 property
- Telemetrics
- Issues and Contributions
- Licencing
Supported Analytics Sites:
- Google Analytics (GA4) [Free]
-
- User & new user charts supported
- Location (city) map & charts supported
- Events (with dimensions and metrics) supported
- Engagement time charts supported
- Screen resolution chart supported
- More coming soon (upon request)
Usage
Setting up
First, reference the `LethalAnalytics.dll` file (downloaded or Github) from your project.
In order to access the LethalAnalytics API, use the `LethalAnalytics` namespace:
using LethalAnalytics;
Also include LethalAnalytics as a `BepInDependency` of your mod so that BepInEx can work its dependency graphing magic (and properly load LethalAnalytics):
[BepInPlugin(modGUID, modName, modVersion)]
[BepInDependency("net.RB007.LethalAnalytics")] NEVER collect PII or otherwise private info. Please be transparent and respect user privacy. Make the Lethal Company modding community proud! |
| measurementId | string | Your GA4 measurement ID (ex. G-RB007ONKOFI). Check that this is correct. Be careful about sharing it and feel free to hide/obfuscate it in your code if desired. |
| screenTitle | string (optional) | The title name to send when a session is created for GA4 (default: MainMenu). |
| renewScreenTitle | string (optional) | The title name to send when a session is continued for GA4 (default: InGame). |
| sendSystemInfo | bool (optional) | Whether to send the user's CPU and GPU type along with the GA4 session_start event (as event params). OS info and screen res. will be sent regardless. |
| sessionLengthMins | int (optional) | How long a GA4 user session is set to last in minutes (default: 30). By default, sessions are re-created if they timeout (as long as the game is still open). Only change this if you know what you're doing. |
By default, every instance of `GASession` sends a few user events:
| Event Name | Description |
|:--------|:-------------|
| session_start | This event is sent as soon as the `registerGASession(...)` method is called for each user. It starts each user's session. |
| page_visit | This event is sent as soon as the `registerGASession(...)` method is called for each user. Includes some basic version info (and their CPU (type) and GPU (type) if enabled). |
| first_visit | This event is sent as soon as `registerGASession(...)` method is called for each user (for the first time). It's what lets you know if a user ran your mod for the first time. |
| update | This event is sent as soon as each user reaches Lethal Company's main menu (and they just updated your mod). It's what lets you know if a user recently updated your mod (and to what version). |
| session_end | This event is sent as soon as each user quits Lethal Company (through the main menu). It ends each user's session. |
Sending GA events
In order to send GA events, you'll need an instance of a `GASession`. It's recommended that you store the previously shown GASession instance in an internal static variable. That way, you can safely access it throughout your mod assembly.
internal static GASession gaSession = AnalyticsManager.registerGASession(...);
Then, call the `sendGAEvent(...) method, from your GASession` instance, to send custom GA events to your property.
gaSession.sendGAEvent("category", "name", new Dictionary() { ["event_param"] = "event_value" });
Please be careful about sending events too quickly and keep event params minimal. Y
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: