Skip to content

Commit 6c75d0c

Browse files
authored
Merge pull request #365 from adjust/docs-localisation
Docs localisation & Swift app update
2 parents ace81b8 + 7e93de9 commit 6c75d0c

File tree

16 files changed

+3669
-432
lines changed

16 files changed

+3669
-432
lines changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This is the iOS SDK of Adjust™. You can read more about Adjust™ at [adjust.c
44

55
If your app is an app which uses web views you would like to use adjust tracking from Javascript code, please consult our [iOS web views SDK guide][ios-web-views-guide].
66

7+
Read this in other languages: [English][en-readme], [中文][zh-readme], [日本語][ja-readme], [한국어][ko-readme].
8+
79
## Table of contents
810

911
* [Example apps](#example-apps)
@@ -994,6 +996,11 @@ If you are seing any value in the dashboard other than what you expected to be t
994996
[dashboard]: http://adjust.com
995997
[adjust.com]: http://adjust.com
996998

999+
[en-readme]: README.md
1000+
[zh-readme]: doc/chinese/README.md
1001+
[ja-readme]: doc/japanese/README.md
1002+
[ko-readme]: doc/korean/README.md
1003+
9971004
[arc]: http://en.wikipedia.org/wiki/Automatic_Reference_Counting
9981005
[examples]: http://github.com/adjust/ios_sdk/tree/master/examples
9991006
[carthage]: https://github.com/Carthage/Carthage
@@ -1036,15 +1043,14 @@ If you are seing any value in the dashboard other than what you expected to be t
10361043
[xcode-associated-domains]: https://raw.github.com/adjust/sdks/master/Resources/ios/xcode-associated-domains5.png
10371044
[universal-links-dashboard]: https://raw.github.com/adjust/sdks/master/Resources/ios/universal-links-dashboard5.png
10381045

1039-
[associated-domains-applinks]: https://raw.github.com/adjust/sdks/master/Resources/ios/associated-domains-applinks.png
1046+
[associated-domains-applinks]: https://raw.github.com/adjust/sdks/master/Resources/ios/associated-domains-applinks.png
10401047
[universal-links-dashboard-values]: https://raw.github.com/adjust/sdks/master/Resources/ios/universal-links-dashboard-values5.png
10411048

10421049
## <a id="license"></a>License
10431050

10441051
The Adjust SDK is licensed under the MIT License.
10451052

1046-
Copyright (c) 2012-2018 adjust GmbH,
1047-
http://www.adjust.com
1053+
Copyright (c) 2012-2019 Adjust GmbH, http://www.adjust.com
10481054

10491055
Permission is hereby granted, free of charge, to any person obtaining a copy of
10501056
this software and associated documentation files (the "Software"), to deal in

doc/chinese/README.md

Lines changed: 1075 additions & 0 deletions
Large diffs are not rendered by default.

doc/chinese/fb_pixel.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
## Facebook像素集成
2+
3+
[Facebook像素](https://www.facebook.com/business/help/952192354843755)是由Facebook提供的仅限于Web的分析工具。在过去,我们无法使用Facebook SDK来跟踪应用网页视图(Webview)中的像素事件。[FB SDK](https://developers.facebook.com/docs/analytics)4.34版本的发布使之成为可能,并通过[混合移动应用事件(Hybrid Mobile App Events)](https://developers.facebook.com/docs/app-events/hybrid-app-events)将Facebook像素事件转化为Facebook应用事件。
4+
5+
您现在还可通过Adjust SDK跟踪Facebook像素,而无需集成FB SDK。
6+
7+
## Facebook集成
8+
9+
### 示例应用
10+
11+
[`AdjustExample-FbPixel`目录][example-fbpixel]中的示例应用向您演示了如何使用Adjust网页视图SDK跟踪Facebook像素事件。
12+
13+
### Facebook应用ID
14+
15+
虽然无需集成FB SDK,但您必须遵循与FB SDK相同的一些集成步骤以将Facebook像素集成到Adjust SDK中。
16+
17+
[FB SDK iOS SDK指南]https://developers.facebook.com/docs/ios/getting-started/#xcode)中所述,您须将Facebook应用ID添加到应用中。 您可按照该指南中的步骤操作,同时我们将步骤复制如下:
18+
19+
- 在Xcode中,右键单击项目的`Info.plist`文件,然后选择Open As(打开方式) - > Source Code(源代码)。
20+
- 在最后的`</ dict>`元素前将以下XML代码片段插入到文件正文中:
21+
22+
```xml
23+
<dict>
24+
...
25+
<key>FacebookAppID</key>
26+
<string>{your-app-id}</string>
27+
...
28+
</dict>
29+
```
30+
31+
- 将`{your-app-id}`替换为您应用的应用ID(该ID可在*Facebook应用控制面板*中找到)。
32+
33+
### Facebook像素配置
34+
35+
请参考Facebook指南了解如何集成Facebook像素。Javascript代码应如下所示:
36+
37+
```js
38+
<!-- Facebook Pixel Code -->
39+
<script>
40+
!function(f,b,e,v,n,t,s)
41+
...
42+
fbq('init', <YOUR_PIXEL_ID>);
43+
fbq('track', 'PageView');
44+
</script>
45+
...
46+
<!-- End Facebook Pixel Code -->
47+
```
48+
49+
现在,正如[混合移动应用事件指南]https://developers.facebook.com/docs/app-events/hybrid-app-events)`Update Your Pixel(更新您的像素)`部分所述,您须更新Facebook像素代码如下:
50+
51+
```js
52+
fbq('init', <YOUR_PIXEL_ID>);
53+
fbq('set', 'mobileBridge', <YOUR_PIXEL_ID>, <YOUR_FB_APP_ID>);
54+
```
55+
56+
**注意****非常重要**的一点是您必须首先调用''init'`并且之后立即调用`'set'`方法。Facebook提供给您需粘贴到HTML网页的代码片段(如上所示)包含调用`'init'`方法后的页面视图事件的`'track'`方法。为了正确跟踪此页面视图事件,请务必在两者之间调用`'set'`方法!
57+
58+
## Adjust集成
59+
60+
### 加载网页视图
61+
62+
请按照[iOS Web视图](web_views.md)应用的集成指南进行操作。如下文加载网页视图桥:
63+
64+
```objc
65+
- (void)viewWillAppear:(BOOL)animated {
66+
...
67+
UIWebView *webView = [[UIWebView alloc] initWithFrame:self.view.bounds];
68+
// or with WKWebView:
69+
// WKWebView *webView = [[WKWebView alloc] initWithFrame:self.view.bounds];
70+
71+
// add @property (nonatomic, strong) AdjustBridge *adjustBridge; on your interface
72+
self.adjustBridge = [[AdjustBridge alloc] init];
73+
[self.adjustBridge loadUIWebViewBridge:webView];
74+
// optionally you can add a web view delegate so that you can also capture its events
75+
// [self.adjustBridge loadUIWebViewBridge:webView webViewDelegate:(UIWebViewDelegate*)self];
76+
77+
// or with WKWebView:
78+
// [self.adjustBridge loadWKWebViewBridge:webView];
79+
// optionally you can add a web view delegate so that you can also capture its events
80+
// [self.adjustBridge loadWKWebViewBridge:webView wkWebViewDelegate:(id<WKNavigationDelegate>)self];
81+
...
82+
```
83+
84+
无论您选择如何将网页视图加载到Adjust桥,请通过添加以下行来执行该步骤:
85+
86+
```objc
87+
[self.adjustBridge augmentHybridWebView];
88+
```
89+
90+
### 事件名称配置
91+
92+
Adjust网桥SDK将Facebook像素事件转化为Adjust事件。
93+
94+
因此,您必须将Facebook像素映射到特定的Adjust事件,或者在启动Adjust SDK和跟踪任意Facebook像素事件***之前***配置默认的Adjust事件识别码,包括从Facebook像素配置中复制粘贴的`fbq('track', 'PageView');`
95+
96+
为了将Facebook像素事件映射到Adjust事件,请在初始化Adjust SDK之前在`adjustConfig`实例中调用`addFbPixelMapping(fbEventNameKey,adjEventTokenValue)`。应类似以下示例:
97+
98+
```js
99+
adjustConfig.addFbPixelMapping('fb_mobile_search', adjustEventTokenForSearch);
100+
adjustConfig.addFbPixelMapping('fb_mobile_purchase', adjustEventTokenForPurchase);
101+
```
102+
103+
请注意,在跟踪Facebook像素事件:`fbq('track', 'Search', ...);``fbq('track', 'Purchase', ...);` 时应可实现匹配。但遗憾的是我们无法访问Javascript中跟踪的事件名称与FB SDK使用的事件名称之间的完整映射方案。
104+
105+
以下为到目前为止我们收集的事件名称信息,供您参考:
106+
107+
| 像素事件名称 | 对应Facebook应用事件名称
108+
| ---------------- | -------------------------------------
109+
| ViewContent | fb_mobile_content_view
110+
| Search | fb_mobile_search
111+
| AddToCart | fb_mobile_add_to_cart
112+
| AddToWishlist | fb_mobile_add_to_wishlist
113+
| InitiateCheckout | fb_mobile_initiated_checkout
114+
| AddPaymentInfo | fb_mobile_add_payment_info
115+
| Purchase | fb_mobile_purchase
116+
| CompleteRegistration | fb_mobile_complete_registration
117+
118+
以上列表也许还不完整;Facebook也可能添加或更新当前列表。在测试时,请查看Adjust日志以获取提示信息,例如:
119+
120+
```
121+
未就名称为:'fb_mobile_search'的事件配置默认事件识别码或找到匹配。它将不会被Adjust作为事件来跟踪。
122+
```
123+
124+
如果您未配置映射,还可以选择使用默认的Adjust事件。您只需在初始化Adjust SDK之前调用`adjustConfig.setFbPixelDefaultEventToken(defaultEventToken);`
125+
126+
[example-fbpixel]: ../../examples/AdjustExample-FbPixel

0 commit comments

Comments
 (0)