Giter VIP home page Giter VIP logo

growingio-unity-demo's Introduction

growing-unity-sdk

  • GrowingIO Unity平台埋点SDK集成Demo(基于Unity2019.4)

测试

  • Android.apk为导出demo
  • iOS中为导出demo的Xcode工程

API列表

  • Track: 发送自定义事件, 对应于cstm事件

    public static void Track(string eventName)
    public static void Track(string eventName, Dictionary<string, object> var)
    public static void Track(string eventName, Dictionary<string, object> var, String itemId, String itemKey)
  • TrackPage: 发送自定义Page事件, 对应于page事件

    public static void TrackPage(string pageName)
    public static void TrackPage(string pageName, Dictionary<string, object> var)
  • SetUserId: 设置登录用户ID

    public static void SetUserId(string userId)
  • ClearUserId: 清除登录用户ID

    public static void ClearUserId()
  • SetUserAttributes: 发送一个自定义的用户事件

    public static void SetUserAttributes(Dictionary<string, object> var)

集成步骤

  • Android

    • 将最新版本的vds-android-agent-cdp以及对应依赖的protobuf-lite、gmonitor替换Assets/Plugins/Android目录下对应文件
    • 将Assets/Plugins/Android 下内容以及Assets/Sources 内容拷贝到对应工程目录下
    • 在Assets/Plugins/Android/AndroidManifest.xml中配置对应项目的url scheme
    • 在Assets/Sources/com/growingio/demo/App.java中配置对应启动配置
    • 将Scripts/GrowingIO放入对应工程
    • 更多细节参考Android原生端埋点sdk
    • Edit/Project Settings/Player/Other Settings 中配置包名
  • iOS

    • 将最新版本的GrowingCDPCoreKit.framework和Growing.h替换Assets/Plugins/iOS目录下对应文件

    • 将Assets/Plugins/iOS/GrowingIOHelper.mm 放入对应工程目录

    • 将Scripts/GrowingIO放入对应工程

    • 将Editor/BuildPostProcessor.cs放入对应工程目录(目前依赖framework支持直接勾选, 如果希望通过勾选配置以及手动配置scheme, 请参考原生sdk文档)

    • 在导出的Xcode工程中UnityAppController.mm文件中添加如下代码完成初始化

      #import <WebKit/WebKit.h>
      #import "Growing.h"
      
      - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
      {
        	...
          [Growing startWithAccountId:@"AccountId" dataSourceId:@"dataSourceId"];
          [Growing setTrackerHost:@"host"];
          [Growing setEnableLog:YES];
      }
    • 更多细节参考iOS原生端埋点sdk

    • Edit/Project Settings/Player/Other Settings 中配置Bundle Identifier

集成效果

  • iOS

image-20210222192400866

image-20210222192626281

  • Android

image-20210222195150847

growingio-unity-demo's People

Contributors

styluo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.