Countly Documentation

Countly Resources

Here you'll find comprehensive guides to help you start working with Countly as quickly as possible.

Unsupported SDK

This community-supported SDK is discontinued and shouldn't be deployed in a production environment. Use it at your own risk.

This document explains how to download, setup and use Unity 3D SDK for Countly. You can download latest release from Github.

Setting up SDK

Unity3D SDK is really easy to utilize. The basic setup is:

  1. Import Countly SDK into your project
  2. Create an empty object in your game scene and add Countly Manager script to it
  3. Fill in your server host (example: or another, if you’re using your own server) and APP key, copied from your dashboard.

After that, Countly will automatically handle all the basic info about sessions. However, there’s more features that SDK provides.

Which server/host name should I use inside SDK?

If you are using Countly Enterprise Edition trial servers, use

If you use Community Edition and Enterprise Edition, use your own domain name or IP address.

Sending custom events

To emit an event, simply call the following code from any of your scripts:

CountlyManager.Emit(“event key”); 

You can also input additional parameters. Countly supports price and count values by default. Use call:

CountlyManager.Emit(“crystal”, 1, 20); 

To tell server that user made a purchase of 1 item with key “crystal” and price of 20. To send more information about your event, use segmentation feature. Simply create a dictionary with your values and put it in your call.

Dictionary<string, string> segmentation  =  new Dictionary<string, string>() {
{“Country”, “Africa”},                       
{“Gender”, “Male”} 

CountlyManager.Emit(“crystal”, 1, 20, segmentation)

Sending crash reports

Countly will handle Crash reports generated by Unity and send them to server on start of new session. If you need to generate crash reports yourself, use this code:

CrashReporter.reports.Add(new CrashReporter.CountlyCrashReport("Error")); 

Then to access its values, use:

CrashReporter.reports[0].parameters[“parameter key”]  = “your value”; 

For list of keys refer to crash analytics data format. Additional parameters can be added using:

CrashReporter.reports[0].custom.Add(“Key”, “Value”); 

User profiles

To get user profile reference, use this code:

Profile profile  =  CountlyManager.GetProfile(); 

Then, to change profile values;  =  “John”;            
profile.byear  =  “1989”; 

Full list of user properties you can set is available here.

You can add custom properties by using:

profile.custom.Add(“Key”, “Value”); 

Finally, to send your profile to the server after you’ve made changes


Tracking campaign clicks

Unity3D SDK also supports referral analytics. It's possible to track campaigns that you created.

To attribute a campaign click, use

CountlyManager.Attribute(“campaign ID”); 

Your campaign ID can be found under "Referrals" tab. For example, if your campaign url is then your campaign ID is abc12345