Skip to content

unity-package/app-tracking-unity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Made With Unity License Last Commit Repo Size Last Release

What

  • Support tracking for game unity (Firebase Analytic, Adjust and AppsFlyer)

How To Install

Add the line below to Packages/manifest.json

for version 1.0.3

"com.wolf-org.tracking":"https://github.com/unity-package/app-tracking-unity.git#1.0.3",

Use

Firebase Tracking

    static void TrackEvent(string eventName)
    static void TrackEvent(string eventName, string parameterName, string parameterValue)
    static void TrackEvent(string eventName, Dictionary<string, string> dictParameters)
    static void TrackEvent(string eventName, Parameter[] parameters)

Example

        void TrackNoParam()
        {
            FirebaseTracking.TrackEvent("WinGame");
        }

        /// <summary>
        /// parameter_name: level
        /// parameter_value: level_1
        /// </summary>
        void TrackOneParam()
        {
            FirebaseTracking.TrackEvent("WinGame", "level", "level_1");
        }

        void TrackHasPramDict()
        {
            Dictionary<string, string> dict = new Dictionary<string, string>();
            dict.Add("level", "level_1");
            dict.Add("level", "level_2");
            dict.Add("level", "level_3");
            FirebaseTracking.TrackEvent("WinGame", dict);
        }

        void TrackHasPram()
        {
            Parameter[] parameters = new[]
            {
                new Parameter("level", "level_1"),
                new Parameter("level", "level_2"),
                new Parameter("level", "level_3")
            };
            FirebaseTracking.TrackEvent("WinGame", parameters);
        }
  • Tracking ads revenue
    static void FirebaseAnalyticTrackRevenue(double value, string network, string unitId, string format, string adNetwork)

Example

        void TrackingRevenue()
        {
            FirebaseAnalyticTrackingRevenue.FirebaseAnalyticTrackRevenue(...);
        }

Adjust Tracking

  • Add define symbol VIRTUESKY_ADJUST to use (Get Adjust Sdk)
  • Tracking event
    static void TrackEvent(string eventToken)

Example

        void TrackingEventAdjust()
        {
            AdjustTracking.TrackEvent("asdwdsfwa");
        }
  • Tracking ads revenue
    static void AdjustTrackRevenue(double value, string network, string unitId, string placement, string adNetwork)

Example

        void TrackingRevenue()
        {
            AdjustTrackingRevenue.AdjustTrackRevenue(...);
        }

AppsFlyer Tracking

    static void TrackEvent(string eventName)
    static void TrackEvent(string eventName, string parameterName, string parameterValue)
    static void TrackEvent(string eventName, Dictionary<string, string> eventValues)

Example

        void TrackNoParam()
        {
            AppsFlyerTracking.TrackEvent("WinGame");
        }

        /// <summary>
        /// parameter_name: level
        /// parameter_value: level_1
        /// </summary>
        void TrackOneParam()
        {
            AppsFlyerTracking.TrackEvent("WinGame", "level", "level_1");
        }

        void TrackHasPramDict()
        {
            Dictionary<string, string> dict = new Dictionary<string, string>();
            dict.Add("level", "level_1");
            dict.Add("level", "level_2");
            dict.Add("level", "level_3");
            AppsFlyerTracking.TrackEvent("WinGame", dict);
        }
  • Tracking ads revenue
    static void AppsFlyerTrackRevenueAd(double value, string network, string unitId, string format, string adNetwork)

Example

        void TrackingRevenue()
        {
            AppsFlyerTrackingRevenue.AppsFlyerTrackRevenueAd(...);
        }
  • Tracking iap revenue Add define symbol VIRTUESKY_IAP to use
    static void AppFlyerTrackingRevenueInAppPurchase(Product product)

Example

        void TrackingRevenue(Product productIAP)
        {
            AppsFlyerTrackingRevenue.AppFlyerTrackingRevenueInAppPurchase(productIAP);
        }

App Tracking

  • Tracking ad revenue (If calling Track Revenue through App Tracking, revenue will be tracked in all of Firebase Analytics, Adjust, and AppsFlyer)
    static void TrackRevenue(double value, string network, string unitId, string format, string adNetwork)

Example

        void TrackingRevenue()
        {
            AppTracking.TrackRevenue(...);
        }
  • Firebase tracking ATT Results IOS (App Tracking Transparency)
  • Require: "com.unity.ads.ios-support": "1.2.0"
    static void FirebaseAnalyticTrackATTResult(int status)

Example

        void AppTrackingTransparency()
        {
            if (ATTrackingStatusBinding.GetAuthorizationTrackingStatus() ==
                ATTrackingStatusBinding.AuthorizationTrackingStatus.NOT_DETERMINED)
            {
                ATTrackingStatusBinding.RequestAuthorizationTracking(AppTracking.FirebaseAnalyticTrackATTResult);
            }
        }