Flutter 플러그인 연동
아래 경로에 있는
pubspec.yaml
파일에 dot_flutter: ^1.0.8
dependency를 추가합니다.

dependencies:
flutter:
sdk: flutter
# Wisetracker Analytics SDK
dot_flutter: ^1.0.8
flutter pub get
import 'package:dot_flutter/dot_flutter.dart';
빨간색으로 표시된 build.gradle 파일의 dependencies에
base_module
과 new_dot_module
implementation을 추가합니다.

dependencies {
// V2
implementation "com.sdk.wisetracker:base_module:latest.release"
implementation "com.sdk.wisetracker:new_dot_module:latest.release"
}
프로젝트폴더 내부의 android 폴더에서
android/app/src/main/res/values
경로로 들어갑니다. strings.xml 파일이 없고, styles.xml 파일만 존재할 경우 strings.xml 파일을 새로 생성하여 주세요. 아래 경로 그림을 참고해 주세요.
왼쪽은 폴더 내 경로 , 오른쪽은 안드로이드 스튜디오 경로
<resources>
<string name="app_name">SampleFlutter</string>
<string-array name="dotAuthorizationKey">
<item name="useMode">1</item>
<item name="serviceNumber">xxxxx</item> <!--서비스 번호 필수 변경! -->
<item name="expireDate">14</item>
<item name="isDebug">false</item>
<item name="isInstallRetention">true</item>
<item name="isFingerPrint">true</item>
<item name="accessToken"></item>
</string-array>
</resources>
추가한 코드 중
✔
serviceNumber
의 value를 올바른 값으로 변경해야 합니다. 
서비스번호 확인
프로젝트의 Target API 28 이상일 경우 AndroidManifest.xml 파일에서 application부분에
android:networkSecurityConfig="@xml/network_security_config"
코드를 추가하여 Http 통신 허용 추가합니다.
AndroidManifest.xml 파일 경로 : 왼쪽은 폴더 , 오른쪽은 안드로이드 스튜디오 경로
<!-- AndroidManifest.xml -->
<application
android:label="my_app"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"
android:networkSecurityConfig="@xml/network_security_config">
AndroidManifest.xml 완료 후 프로젝트명/android/app/src/main/res 경로에 xml 폴더를 새로 만든 후
network_security_config.xml
파일을 새로 생성하여 아래의 코드를 복사, 붙여넣기 합니다.
왼쪽은 폴더 내 경로 , 오른쪽은 안드로이드 스튜디오 경로
<!-- app/res/xml/network_security_config.xml -->
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">trk.analytics.wisetracker.co.kr</domain>
</domain-config>
</network-security-config>
Application을 상속받는 클래스가 아닌 Activity를 상속받는 최초 기본/메인 화면의 onCreate() 함수에 적용해 주세요.
(모든 Activity 에 추가하는 것이 아닌 최초로 진입하는 메인 Activity에 1회 적용합니다.)
import com.sdk.wisetracker.new_dot.open.DOT;
class MainActivity: FlutterActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState);
/**
* Wisetracker SDK init
* **/
DOT.initialization(this);
};
}

왼쪽은 폴더 내 경로 , 오른쪽은 안드로이드 스튜디오 경로
아래 페이지로 이동하여 Android Facebook 광고 성과 측정을 위한 코드를 추가 해 주세요.

SDK 삽입
Wisetracker Docs
Android Facebook 광고성과측정
http통신을 허용하기 위해 info.plist파일을 엽니다. 파일의 위치는 다음과 같습니다.

</dict>검색
을 통해 닫히는 라인 바로 위에 NSAppTransportSecurity
코드를 추가합니다. <key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
</dict>
</plist>
NSAppTransportSecurity 코드를 추가한 곳 바로 아래에
dotAuthorizationKey
도 추가 해 줍니다.<key>dotAuthorizationKey</key>
<dict>
<key>serviceNumber</key>
<string>xxxxx</string> <!--서비스 번호 필수 변경! -->
<key>expireDate</key>
<string>14</string>
<key>isDebug</key>
<string>true</string>
<key>isInstallRetention</key>
<string>true</string>
<key>isFingerPrint</key>
<string>true</string>
<key>accessToken</key>
<string></string>
<key>useMode</key>
<string>2</string>
</dict>
추가한 코드 중
serviceNumber
의 value를 올바른 값으로 변경해야 합니다. 와이즈트래커 애널리틱스에 로그인하여 화면 상단의 Service 부분을 선택하면 앱 이름과 함께 올바른 Service Number 가 나타납니다. Service No. 옆의 숫자를 복사하여 serviceNumber
의 value로 입력해주세요.
서비스 번호는 숫자 다섯자리
iOS 실행시 Pod install에서 이슈 발생하는 경우 ios/Podfile 내에 use_frameworks! 부분을 아래와 같이 주석처리를 해주세요.
target 'Runner' do
# use_frameworks!
use_modular_headers!
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end
AppDelegate의
didFinishLaunchingWithOptions
함수에 SDK를 Initialization하기 위한 코드를 다음과 같이 적용합니다. AppDelegate 파일의 위치는 다음과 같습니다.
왼쪽은 폴더 내 경로 , 오른쪽은 xcode 경로
/** wisetracker SDK import */
import DOT
override func application(
_ application: UIApplication,
...
...
/** wisetracker SDK init */
DOT.initialization(launchOptions, application: application)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
}
아래 페이지로 이동하여 ios Facebook 광고 성과 측정을 위한 코드를 추가 해 주세요.

SDK 삽입
Wisetracker Docs
ios Facebook 광고성과측정
모든 설정 완료 후 log를 통해 데이터 수집을 확인 합니다. (Android 기준)
아래 log 내용은 서비스별로 달라질 수 있으나, Data Receive Success가 기록되는지를 중심으로 확인이 필요합니다.
[WiseLog]: RetrofitLogInterceptor#intercept(33)#DEBUG_MESSAGE#SERVER RESPONSE
-> {"msg":"Data Receive Success","code":"RES001","visitNewServerTime":1657536903244,
"attributedInfo":{"linkId":{},"install":{"isNewInstall":false},"pushMessage":{},
"assist":[],"iosAd":{},"open":{},"abusing":{"installDt":1657256885220,
"regDt":1657256887972,"adid":"","sno"xxxxx:,abuseTarget":"organic","platform":"AOS"}}}
log에 해당 내용이 확인이 된다면 수신이 정상적으로 이루어졌으며, 와이즈트래커의 SDK를 호출할 준비가 완료되었습니다.
ios 확인을 위해 "flutter run" 확인 시 아래와 같은 에러 코드가 발생한다면 다음과 같은 조치를 해야합니다.
⚠
프로젝트 폴더 > ios폴더 > Podfile 에서 가장 상단에 있는 platform : ios 버전을 9.3으로 변경 해 주세요. (주석 처리가 되어 있다면 주석 해제 후 9.3 버전으로 수정)
[!] Automatically assigning platform `iOS` with version `9.0` on target `Runner` because no platform was specified. Please specify a platform for this target in your Podfile. See
`https://guides.cocoapods.org/syntax/podfile.html#platform`.

☑️Flutter SDK 설정을 도와드리기위한 샘플코드가 제작되어 있습니다.
해당 가이드 참고시 샘플 코드도 함께 참고 하신다면, SDK 적용을 수월하게 진행하실 수 있습니다.
Last modified 19d ago