javascript 是否可以从 iPhone 智能横幅跟踪点击率

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12906502/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 17:24:42  来源:igfitidea点击:

Is it possible to track click throughs from iPhone Smart Banner

javascriptiphonehtmlios

提问by danielsan

We want to be able to track, using Google Analytics, any click throughs from the iPhone Smart Bannerthat we have added to our website.

我们希望能够使用 Google Analytics 跟踪我们添加到我们网站的iPhone 智能横幅的任何点击。

The meta code used to add the smart banner is:

用于添加智能横幅的元代码是:

<meta name="apple-itunes-app" content="app-id=myAppStoreID">

<meta name="apple-itunes-app" content="app-id=myAppStoreID">

So far I've tried dumping the page DOM using javascript to see if there is any associated HTML, but it seems the smart banner is outside of the DOM and possibly at the safari or browser app level?

到目前为止,我已经尝试使用 javascript 转储页面 DOM 以查看是否有任何关联的 HTML,但似乎智能横幅在 DOM 之外并且可能在 safari 或浏览器应用程序级别?

Ideally we would like to use the standard browser based javascript google analytics tracking code, as modifying our app itself to accept parameters being parsed through is not currently an option.

理想情况下,我们希望使用基于标准浏览器的 javascript 谷歌分析跟踪代码,因为修改我们的应用程序本身以接受正在解析的参数目前不是一个选项。

Does anyone know how we could track click throughs from the smart banner to open or install the app?

有谁知道我们如何从智能横幅跟踪点击率以打开或安装应用程序?

回答by Sandeep

Here's an update to this. To answer the original question: Yes you can track clicks on smartapp banners on the website. Here's how.

这是对此的更新。回答最初的问题:是的,您可以跟踪网站上 smartapp 横幅的点击次数。就是这样。

Firstly Linkshare affiliate is history. Sign up for PHG affiliate here

首先,Linkshare 附属公司是历史。在此处注册 PHG 会员

Once you sign up you'll get a affiliate id. Enter your affiliate ID in the Smartapp Meta Tagas shown below

注册后,您将获得一个会员 ID。在Smartapp Meta 标签中输入您的会员 ID,如下所示

<meta name="apple-itunes-app" content="app-id=311507490, affiliate-data=at=11m7as&ct=website_smartapp"/>

Where at=(Your affiliate ID) and ct=[campaign type(enter any text here for your reference)]

其中 at=(您的会员 ID)和 ct=[广告系列类型(在此处输入任何文本供您参考)]

at and ct values with number of clicks will be shown on your PHG dashboard

at 和 ct 值以及点击次数将显示在您的 PHG 仪表板上

Hope this helps

希望这可以帮助

回答by Dan Fabulich

It's not possible to track clickson your Smart Banner, but it is possible to track the number of installsthat come from your Smart Banner. There are threetwo ways you can do it:

无法跟踪Smart Banner上的点击次数,但可以跟踪来自 Smart Banner的安装数量。您可以通过以下三种方式进行操作:

1) Use Tapstreamto track your installs from your web page to the app. It even integrates with Google Analytics.

1) 使用Tapstream跟踪从您的网页到应用程序的安装。它甚至与 Google Analytics 集成。

2) If you have a paid app, you can use the affiliate-data parameter. You'll need to sign up as an iTunes Affiliate(but you should do that anyway if you care about iOS analytics; it's the only official way to measure conversion rates on iOS).

2) 如果您有付费应用,则可以使用affiliate-data 参数。您需要注册为iTunes Affiliate(但如果您关心 iOS 分析,无论如何都应该这样做;这是衡量 iOS 转换率的唯一官方方法)。

Here's the instructions for Linkshare, the US affiliate partner. Log in to Linkshare, click Links -> Deep Linking in the menu. Select "US iTunes, App Store, iBookstore, and Mac App Store" as your advertiser and paste in an itunes URL. You'll get a link like this:

这是美国附属合作伙伴 Linkshare 的说明。登录Linkshare,在菜单中点击Links -> Deep Linking。选择“美国 iTunes、App Store、iBookstore 和 Mac App Store”作为您的广告商并粘贴 iTunes URL。你会得到一个这样的链接:

http://click.linksynergy.com/fs-bin/click?id=XXXXXXXXXXX&subid=&offerid=[...]

That "id=XXXXXXXXXX" section is your site ID. Linkshare's partner ID is 30. So put this in your smart banner:

“id=XXXXXXXXXX”部分是您的站点 ID。Linkshare 的合作伙伴 ID 是 30。所以把它放在你的智能横幅中:

<meta name="apple-itunes-app" content="app-id=311507490,
  affiliate-data=partnerId=30&siteID=XXXXXXXXX"/>

Where XXXXXXXXXX is your site ID. Linkshare can then tell you how many installs you received.

其中 XXXXXXXXXX 是您的站点 ID。Linkshare 然后可以告诉您您收到了多少安装。

3) Use the app-argument parameter to pass data from your web page to your app, and record the number of installs yourself. (You'll have to keep/manage the logs yourself on your own server, but at least you'll have the data.)EDIT: As pointed out in a comment, app-argument only applies if you click Open when the app is already installed; it does not help to track installs.

3)使用app-argument参数从你的网页向你的应用传递数据,自己记录安装次数。(您必须自己在自己的服务器上保留/管理日志,但至少您将拥有数据。)编辑:正如评论中所指出的,应用程序参数仅适用于当应用程序打开时单击打开已安装; 它无助于跟踪安装

回答by Gallonallen

I think you will need to track this from the app rather than from the website. If you have implemented the application:openURL:sourceApplication:annotation:method in your app delegate then you should be able to send an event to google analytics from within that method.

我认为你需要从应用程序而不是从网站跟踪这个。如果您已经application:openURL:sourceApplication:annotation:在您的应用程序委托中实现了该方法,那么您应该能够从该方法中向谷歌分析发送一个事件。

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    [tracker sendEventWithCategory:@"uiAction"
                        withAction:@"openFromSmartBanner"
                         withLabel:[NSString stringWithFormat@"%@",[url absoluteString]
                         withValue:nil];
    return YES;
}

This will trigger every time your app is opened from a smart banner and tell you what url it came from (if available from multiple websites). This will only give you clicks when the smart banner shows openbutton not when it shows view

每次从智能横幅打开您的应用程序时,这都会触发并告诉您它来自哪个网址(如果可以从多个网站获得)。这只会在智能横幅显示open按钮时给你点击,而不是在它显示时给你点击view

回答by whoughton

No, unfortunately.

不,不幸的是。

If you link the iOS simulator (you can also link your actual device) to the safari webkit inspector you'll notice that the full HTML body exists outside of the banner displayed, meaning that you have no scope to reach into to attach tracking events to.

如果您将 iOS 模拟器(您也可以链接您的实际设备)链接到 safari webkit 检查器,您会注意到完整的 HTML 正文存在于所显示的横幅之外,这意味着您无法进入以将跟踪事件附加到.

Web Inspector Screenshot

Web Inspector 屏幕截图

Note that in this screenshot the mouse is hovering over the element, thus you see it highlighted in the simulator to the left.

请注意,在此屏幕截图中,鼠标悬停在元素上,因此您会在左侧的模拟器中看到它突出显示。

FYI, for details on how to connect your desktop inspector to a mobile environment, see here (spoiler, it's AWESOMELY useful): http://webdesign.tutsplus.com/tutorials/workflow-tutorials/quick-tip-using-web-inspector-to-debug-mobile-safari/

仅供参考,有关如何将桌面检查器连接到移动环境的详细信息,请参见此处(剧透,非常有用):http://webdesign.tutsplus.com/tutorials/workflow-tutorials/quick-tip-using-web-检查员到调试移动 safari/