https://github.com/awslabs/clickstream-unity

Unity SDK for Clickstream Analytics on AWS

https://github.com/awslabs/clickstream-unity

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    1 of 3 committers (33.3%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.4%) to scientific vocabulary

Keywords

analytics aws aws-clickstream-solution aws-solution clickstream clickstream-unity unity unity-plugin
Last synced: 5 months ago · JSON representation

Repository

Unity SDK for Clickstream Analytics on AWS

Basic Info
Statistics
  • Stars: 4
  • Watchers: 16
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Topics
analytics aws aws-clickstream-solution aws-solution clickstream clickstream-unity unity unity-plugin
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme Contributing License Code of conduct

README.md

AWS Solution Clickstream Analytics SDK for Unity

Introduction

Clickstream Unity SDK can help you easily collect and report events from Unity Games to AWS. This SDK is part of an AWS solution - Clickstream Analytics on AWS, which provisions data pipeline to ingest and process event data into AWS services such as S3, Redshift.

The SDK provide easy to use API for data collection. In addition, we've added features that automatically collect common user events and attributes (e.g., app start and scene load) to simplify data collection for users.

Integrate SDK

Include SDK

We use Unity Package Manager to distribute our SDK

  1. Open Window and click Package Manager in Unity Editor.
  2. Click + button, then select Add package from git URL...
  3. Input https://github.com/awslabs/clickstream-unity , then click Add to wait for completion.

Initialize the SDK

```c# using ClickstreamAnalytics;

ClickstreamAnalytics.Init(new ClickstreamConfiguration { AppId = "your AppId", Endpoint = "https://example.com/collect" }); ```

Start using

Record event

```c# using ClickstreamAnalytics;

var attributes = new Dictionary { { "eventcategory", "shoes" }, { "currency", "CNY" }, { "value", 279.9 } }; ClickstreamAnalytics.Record("buttonclick", attributes);

// record event with name ClickstreamAnalytics.Record('button_click'); ```

Login and logout

```c# using ClickstreamAnalytics;

// when user login success. ClickstreamAnalytics.SetUserId("UserId");

// when user logout ClickstreamAnalytics.SetUserId(null); ```

Add user attribute

```c# using ClickstreamAnalytics;

var userAttrs = new Dictionary { { "userName", "carl" }, { "userAge", 22 } }; ClickstreamAnalytics.SetUserAttributes(userAttrs); ```

When opening for the first time after integrating the SDK, you need to manually set the user attributes once, and current login user's attributes will be cached in PlayerPrefs, so the next time game start you don't need to set all user's attribute again, of course you can use the same api ClickstreamAnalytics.SetUserAttributes() to update the current user's attribute when it changes.

Add global attribute

  1. Add global attributes when initializing the SDK

The following example code shows how to add global attributes when initializing the SDK.

```c# using ClickstreamAnalytics;

ClickstreamAnalytics.Init(new ClickstreamConfiguration { AppId = "your AppId", Endpoint = "https://example.com/collect", GlobalAttributes = new Dictionary { { "appinstall_channel", "Amazon Store" } } }); ```

  1. Add global attributes after initializing the SDK

```c# using ClickstreamAnalytics;

ClickstreamAnalytics.SetGlobalAttributes(new Dictionary { { "trafficsource_source", "Search engine" }, { "level", 10 } }); ```

It is recommended to set global attributes when initializing the SDK, global attributes will be included in all events that occur after it is set, you also can remove a global attribute by setting its value to null.

Other configurations

In addition to the required AppId and Endpoint, you can configure other information to get more customized usage:

```c# using ClickstreamAnalytics;

ClickstreamAnalytics.Init(new ClickstreamConfiguration { AppId = "your AppId", Endpoint = "https://example.com/collect", SendEventsInterval = 10000, IsCompressEvents = true, IsLogEvents = false, IsUseMemoryCache = false, IsTrackAppStartEvents = true, IsTrackAppEndEvents = true, IsTrackSceneLoadEvents = true, IsTrackSceneUnLoadEvents = true }); ```

Here is an explanation of each property:

  • AppId (Required): the app id of your project in control plane.
  • Endpoint (Required): the endpoint path you will upload the event to AWS server.
  • SendEventsInterval: event sending interval millisecond, works only bath send mode, the default value is 10000
  • IsLogEvents: whether to print out event json for debugging, default is false.
  • IsUseMemoryCache: whether to use memory to cache events for better performance, default is false.
  • IsTrackAppStartEvents: whether auto record app start events when game becomes visible, default is true
  • IsTrackAppEndEvents: whether auto record app end events when game becomes invisible, default is true
  • IsTrackSceneLoadEvents: whether auto record scene load events, default is true
  • IsTrackSceneUnLoadEvents: whether auto record scene unload events, default is true

Configuration update

You can update the default configuration after initializing the SDK, below are the additional configuration options you can customize.

```c# using ClickstreamAnalytics;

ClickstreamAnalytics.UpdateConfiguration(new Configuration { AppId = "your AppId", Endpoint = "https://example.com/collect", IsCompressEvents = false, IsLogEvents = true, IsTrackAppStartEvents = false, IsTrackAppEndEvents = false, IsTrackSceneLoadEvents = false, IsTrackSceneUnLoadEvents = false }); ```

Debug events

You can follow the steps below to view the event raw json and debug your events.

  1. Using ClickstreamAnalytics.Init() API and set the IsLogEvents attribute to true in debug mode.
  2. Integrate the SDK and start your game in Unity Editor, then open the Console tab.
  3. Input [ClickstreamAnalytics] in the filter, and you will see the json content of all events recorded by Clickstream Unity SDK.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Owner

  • Name: Amazon Web Services - Labs
  • Login: awslabs
  • Kind: organization
  • Location: Seattle, WA

AWS Labs

GitHub Events

Total
  • Watch event: 1
  • Delete event: 1
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 2
  • Create event: 1
Last Year
  • Watch event: 1
  • Delete event: 1
  • Push event: 1
  • Pull request review event: 1
  • Pull request event: 2
  • Create event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 4
  • Total Committers: 3
  • Avg Commits per committer: 1.333
  • Development Distribution Score (DDS): 0.5
Past Year
  • Commits: 4
  • Committers: 3
  • Avg Commits per committer: 1.333
  • Development Distribution Score (DDS): 0.5
Top Committers
Name Email Commits
Xiaowei Zhu 3****i 2
xiaoweii x****i@a****m 1
Amazon GitHub Automation 5****o 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 8 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: 8 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • zhu-xiaowei (3)
Top Labels
Issue Labels
Pull Request Labels
enhancement (1) documentation (1)

Dependencies

.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • softprops/action-gh-release v1 composite
.github/workflows/test.yml actions
  • actions/checkout v4 composite
  • actions/upload-artifact v3 composite
  • game-ci/unity-test-runner v4 composite
.github/workflows/title-lint.yml actions
  • amannn/action-semantic-pull-request v5 composite
package.json npm
yarn.lock npm