gpt4 book ai didi

cordova - 如何在 Ionic/Cordova 中获取搜索广告应用归因 API 信息

转载 作者:行者123 更新时间:2023-12-02 03:47:49 24 4
gpt4 key购买 nike

苹果的Search Ads Attribution API看起来很简单。我想知道是否有一个插件可以实现这一点?

最佳答案

Cordova/Ionic 的 Search Ads API 插件不存在,所以我创建了它。您可以check out the plugin code on Github ,查看Ionic demo app code on Github或者继续阅读有关如何使用它的示例。

You can also check out the step by step tutorial about How to create a native iOS app that can read Search Ads Attribution API information if you're not into hybrid solutions 😯

什么是搜索广告应用归因?

来自Apple's documentation :

Search Ads App Attribution enables developers to track and attribute app downloads that originate from Search Ads campaigns. With Search Ads App Attribution, iOS developers have the ability to accurately measure the lifetime value of newly acquired users and the effectiveness of their advertising campaigns.

如何使用插件

如果您想在空白项目上进行测试,您可以创建一个新的 Ionic 项目,如下所示:

ionic 启动 ionicSearchAdsDemo 选项卡

由于插件已添加到 npm repository ,您可以简单地添加它,如下所示:

ionic 插件添加 cordova-plugin-searchads

DashCtrl Controller 下的controllers.js文件中添加以下代码:

.controller('DashCtrl', function($scope, $ionicPlatform) {
$scope.data = 'no data';

$ionicPlatform.ready(function() {
if (typeof SearchAds !== "undefined") {
searchAds = new SearchAds();

searchAds.initialize(function(attribution) {
console.dir(attribution); // do something with this attribution (send to your server for further processing)
$scope.data = JSON.stringify(attribution);
}, function (err) {
console.dir(err);
});
}
});
})

templates/tab-dash.html 文件的内容替换为:

<ion-view view-title="Dashboard">
<ion-content class="padding">
<div class="card">
<div class="item item-text-wrap">
{{data}}
</div>
</div>
</ion-content>
</ion-view>

通过在终端中执行以下命令来准备项目:

ionic 准备 ios && 开放平台/ios

之后,打开 XCode 项目 (*.xcodeproj) 文件:

确保 iAd.framework 已添加到链接的框架和库中:

当您添加插件时,这应该会自动发生,但最好确保一下。如果您在此处没有看到它,请自行添加。

在您的设备上运行该项目,您应该得到如下内容:

希望这对某人有用! 💪

关于cordova - 如何在 Ionic/Cordova 中获取搜索广告应用归因 API 信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46229215/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com