我想在我的MVC网站上使用google analytics api,使用api服务帐户进行身份验证,oauth2在我的localhost上没有问题,但是一旦我部署到Azure,我就会收到502错误:
"502 - Web服务器在充当网关或代理服务器时收到无效响应.您正在查找的页面存在问题,无法显示.当Web服务器(充当网关或代理)时联系在上游内容服务器上,它收到了来自内容服务器的无效响应."
继承我的代码:
const string ServiceAccountUser = "xxxxxxxxxx-cpla4j8focrebami0l87mbcto09j9j6k@developer.gserviceaccount.com";
AssertionFlowClient client = new AssertionFlowClient(
GoogleAuthenticationServer.Description,
new X509Certificate2(System.Web.Hosting.HostingEnvironment.MapPath("/Areas/Admin/xxxxxxxxxxxxxxxxxx-privatekey.p12"),
"notasecret", X509KeyStorageFlags.Exportable))
{
Scope = AnalyticsService.Scopes.AnalyticsReadonly.GetStringValue(),
ServiceAccountId = ServiceAccountUser //Bug, why does ServiceAccountUser have to be assigned to ServiceAccountId
//,ServiceAccountUser = ServiceAccountUser
};
OAuth2Authenticator<AssertionFlowClient> authenticator = new OAuth2Authenticator<AssertionFlowClient>(client, AssertionFlowClient.GetState);
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚是什么造成的?我在Azure中遗漏了什么?
谢谢你的帮助.
我正在尝试以最简单的方式将Google Analytics连接到我的应用.我想实施分析v4,因为谷歌说他们很快会强制升级到它,所以我不想做同样的工作两次.
在这种情况下,Google的教程效率不高.合并他们在那里说的和我在互联网上找到的东西,我已经做了这个步骤:
在Android Manifest中,我添加了以下权限:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Run Code Online (Sandbox Code Playgroud)
这个,在Application标签下:
<meta-data android:name="com.google.android.gms.analytics.globalConfigResource"
android:resource="@xml/analytics" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
Run Code Online (Sandbox Code Playgroud)
我不确定第二个元的必要性......
我写了一个名为"analytics.xml"(/ res/xml /)的xml文件,其中包含:
<!-- the Local LogLevel for Analytics -->
<string name="ga_logLevel">verbose</string>
<!-- Treat events as test events and don't send to google -->
<bool name="ga_dryRun">false</bool>
<!-- <integer name="ga_sessionTimeout">300</integer> -->
<!-- Enable automatic Activity measurement -->
<bool name="ga_autoActivityTracking">true</bool>
<!-- Enable automatic exception tracking -->
<bool name="ga_reportUncaughtExceptions">true</bool>
<string name="ga_trackingId">UA-52900555-1</string>
<!-- The screen names that will appear in reports -->
<screenName …Run Code Online (Sandbox Code Playgroud) 当我尝试从Google Analytics获取数据时,我收到了错误消息
刷新OAuth2令牌时出错,消息:'{"error":"unauthorized_client","error_description":"请求中未经授权的客户端或范围".}"
我在https://console.developers.google.com/project中创建项目,创建 服务帐户并下载.p12密钥.同时在项目设置中启用"Analytics API",但它不起作用.这是我的代码:
$service_account_name = '<Service Email>@developer.gserviceaccount.com';
$key_file_location = '<keyName>.p12';
$key = file_get_contents($key_file_location);
$cred = new Google_Auth_AssertionCredentials(
$service_account_name,
array(Google_Service_Analytics::ANALYTICS),
$key,
'notasecret',
'http://oauth.net/grant_type/jwt/1.0/bearer',
'<My email>'
);
$client->getAuth()->setAssertionCredentials($cred);
$service = new Google_Service_Analytics($client);
$result = $service->data_ga->get("ga:<profileID>", "yesterday", "today", "ga:pageviews");
print_r( $result);
Run Code Online (Sandbox Code Playgroud)
我的项目有什么问题?请帮忙.
php google-analytics-api oauth-2.0 google-oauth google-api-php-client
我必须在Google Analytics中使用自定义指标和维度.当我尝试在管理部分中创建新数据集时,我看到一条消息,如权限被拒绝.我想为特定指标上传CSV,但无法创建数据集.有关如何授予添加新数据集权限的任何想法?
我通过 Google 的测量 API发送事件- 而不是“普通”的 JS API。
我大约在80 小时前(周四晚些时候到周一早些时候)开始发送事件。
在正常的一天,我们发送大约 200-400 个事件。视图只应用了一个过滤器(过滤掉单个办公室 IP 地址)。
预期行为:事件在实时视图以及“行为”下的报告中都显示良好。
观察到的行为:事件仅显示在实时视图中,而不显示在“行为”下的报告中。
使用细分分析 javascript 库时,如何或必须做什么才能将所有分析数据发送到我自己的服务器?
我愿意通过他们的 API 将 Google Analytics 和 Google Search Console 数据直接显示到 Superset 中。
我怎样才能这样做呢?
我找不到 Google Analytics 数据源。我也找不到 Google Search Console 数据源。
我找不到在 Superset 中显示从 API 检索的数据的方法,只能显示存储在数据库中的数据。我肯定遗漏了一些东西,但我在文档中找不到与身份验证和查询外部 API 相关的任何内容。
如何在 Flutter 中编写营销活动参数?我已启用推送通知。因此,当用户通过通知访问我的应用程序时,我想将一些 UTM 信息写入谷歌分析,例如来源、媒介、活动
我正在使用 Flutter 的“usage 3.4.1”插件,但我没有看到任何选项/API 将 UTM 参数写入 GA
需要一些关于如何完成此任务的帮助......
感谢您的帮助
google-analytics google-analytics-api flutter firebase-analytics
我正在使用 Google 的数据 API 从指标和维度获取不同类型的数据。但在某些情况下,我的维度与日期相同,并且希望基于同一维度获取多个指标。
下面是我的代码,我根据当前日期获取 activeUsers。我想使用一个 API 报告获取多个指标,例如 activeUsers、newUsers、会话,我必须通过传递不同的指标来获取数据来调用下面的 API 3 次。还有其他解决方案吗?
$property_id = 'PROPERTY-ID';
$client = new BetaAnalyticsDataClient();
$response = $client->runReport([
'property' => 'properties/' . $property_id,
'dateRanges' => [
new DateRange([
'start_date' => '2021-06-01',
'end_date' => '2021-06-01',
]),
],
'dimensions' => [new Dimension(
[
'name' => 'date',
]
),
],
'metrics' => [new Metric(
[
'name' => 'activeUsers',
]
)
]
]);
foreach ($response->getRows() as $row) {
print $row->getDimensionValues()[0]->getValue()
. ' ' . $row->getMetricValues()[0]->getValue() . PHP_EOL;
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用以下代码发送两个指标: …
所以这将是我在这里的第一个问题,我会尽力遵守社区规则。我正在尝试使用 PHP 在 Google Analytics Data API (GA4) 中使用多个过滤器。我已经成功地能够使用一个过滤器并将其显示在自定义仪表板中。
下面是获取以值开头的 url 数据的代码:/133。问题是,如何制作一个过滤器来获取多个网址。也就是说,我想要页面的数据以值“/133”、“/88”、“/678”和“/67”开头?
$response = $client->runReport([
'property' => 'properties/' . $property_id,
'dateRanges' => [
new DateRange([
'start_date' => '2022-01-01',
'end_date' => 'today',
]),
],
'dimensions' => [
new Dimension(['name' => 'pageTitle',]),
new Dimension(['name' => 'fullPageUrl',]),
],
'metrics' => [
new Metric(['name' => 'screenPageViews',]),
new Metric(['name' => 'activeUsers',]),
new Metric(['name' => 'newUsers',]),
new Metric(['name' => 'userEngagementDuration',]),
],
'dimensionFilter' => new FilterExpression([
'filter' => new Filter([
'field_name' => 'pagePath',
'string_filter' => new Filter\StringFilter([ …Run Code Online (Sandbox Code Playgroud) oauth-2.0 ×2
php ×2
analytics ×1
android ×1
asp.net-mvc ×1
azure ×1
c# ×1
flutter ×1
google-oauth ×1
javascript ×1
python ×1
segment-io ×1