我们公司目前正在开发一个应用程序,需要通过单个 Google 开发者用户访问多个 Google Analytics 帐户。在遇到以下错误之前,我们已成功将此用户添加到大约 100 个 Analytics 帐户中:
无法将用户添加到帐户。用户已达到 Analytics 帐户的最大数量。
这个错误使我们的工作陷入了停滞。我们想知道是否有任何解决办法可以实施或可以购买升级以提高此帐户限制。
google-analytics google-api google-apps google-analytics-api
Google Analytics Web UI 有一个简洁的报告,称为“用户流”,它显示用户在您网站上导航到不同页面时的行为。可以理解,无法从 Web UI 访问此报告的原始数据,因为它包含数千行。但是,它应该可以通过 API 获得。我已阅读本文以了解如何执行此操作的基本框架。
然而,我从这些努力中得到的结果与我在网站上看到的不符,这让我相信我在某处犯了错误。
图表 A:我正在调查的一个特定交互是用户从主页导航到特定子页面。这种交互很流行,因此在 Web UI 中可见。它显示以下内容:
Home -> Page A = 9.4K Users (doesn't give the exact value =/)
Run Code Online (Sandbox Code Playgroud)
但是,我在调查时的结果认为 API 不匹配。我的基本方法是这样的:
dimensions="ga"landingPagePath,ga:secondPagepath"
metrics="ga:sessions"
Run Code Online (Sandbox Code Playgroud)
这给出了以下结果
Home -> Page A = 1,993 Users
Run Code Online (Sandbox Code Playgroud)
我也从以下查询中得到相同的结果:
dimensions="ga"previousPagePath,ga:pagePath"
metrics="ga:sessions"
Run Code Online (Sandbox Code Playgroud)
我不明白为什么这两个不应该返回相同的结果,我担心我错过了一些明显的东西。在此先感谢您的帮助!
编辑
原来使用的方法
dimensions="ga:previousPagePath,ga:PagePath"
Run Code Online (Sandbox Code Playgroud)
返回 2,951 个用户的不同但仍然不正确的答案
我在使用PHP的谷歌分析API v4上有这个代码.
$eCPM_Adsense = new Google_Service_AnalyticsReporting_Metric();
$eCPM_Adsense->setExpression("ga:adsenseECPM");
$eCPM_Adsense->setAlias("eCPM Adsense");
// Create the Ordering.
$ordering = new Google_Service_AnalyticsReporting_OrderBy();
$ordering->setFieldName("ga:adsenseECPM");
$ordering->setOrderType("VALUE");
$ordering->setSortOrder("DESCENDING");
Run Code Online (Sandbox Code Playgroud)
订购对我不起作用.你能帮助我吗?谢谢
我需要在我使用asp.net Web表单(C#)构建的CMS Web应用程序的仪表板页面中集成来自Google Analytics的非常基本的报告.
我记得我能够在2015年使用API V3进行的测试中做到这一点,但是现在,使用V4,我总是会收到一条错误消息,即验证需要OAuth2.
我需要访问我拥有的特定分析帐户,而不是在CMS中导航的用户帐户!
因此,我使用Google API Manager提供的API KEY.我已经给了API Key所有权限.API密钥类似于:"d471c3ce04612f143ff0Be319aac2e17d0159add"
这是代码
using Google.Apis.AnalyticsReporting.v4;
using Google.Apis.Services;
using System;
using Google.Apis.AnalyticsReporting.v4.Data;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.IO;
using Google.Apis.Auth.OAuth2;
using System.Threading;
using Google.Apis.Util.Store;
using System.Web;
public static class GoogleAnalyticsAPI
{
static string vmcApiKey = "<<API-KEY>>";
public static void Test()
{
AnalyticsReportingService ars = GetService(vmcApiKey);
// Create the DateRange object.
DateRange dateRange = new DateRange() { StartDate = "2017-01-01", EndDate = "2017-04-28" };
// Create the Metrics object.
Metric sessions = …Run Code Online (Sandbox Code Playgroud) c# asp.net google-api google-analytics-api google-api-dotnet-client
如何通过 PHP 使用 Google Analytics GA4 列出所有帐户的所有属性?对于通用分析,我使用以下内容:
function initializeAnalyticsV3()
{
$client = new Google_Client();
$client->setApplicationName("Name");
$client->setAuthConfig($KEY_FILE_LOCATION);
$client->setScopes(['https://www.googleapis.com/auth/analytics.readonly']);
$analytics = new Google_Service_Analytics($client);
return $analytics;
}
$analyticsV3 = initializeAnalyticsV3();
try {
$accounts = $analyticsV3->management_accountSummaries
->listManagementAccountSummaries();
} catch (apiServiceException $e) {
print 'There was an Analytics API service error '
. $e->getCode() . ':' . $e->getMessage();
} catch (apiException $e) {
print 'There was a general API error '
. $e->getCode() . ':' . $e->getMessage();
}
foreach ($accounts->getItems() as $account) {
foreach ($account->getWebProperties() …Run Code Online (Sandbox Code Playgroud) php google-analytics google-analytics-api google-api-php-client google-analytics-4
我正在使用谷歌分析事件跟踪来跟踪2个Facebook画布应用程序.(它们类似于一个用于生产,另一个用于开发).由于它们是2个独立的画布应用程序,因此它们都具有不同的画布URL.
以下是我设置Google Analytics的方法:
物业名称:样品
两个配置文件都具有相同的跟踪ID.我该如何单独跟踪它们?我需要创建过滤器吗?我不确定,但我可能错误地设置了这个.我是否需要创建单独的属性名称?
感谢任何建议.
facebook google-analytics google-analytics-api facebook-canvas
我希望使用Javascript通过API访问Google Analytics数据.基本上我想在网站上显示过去一周/每月访问量最大的页面列表.我只能使用javascript.
我在官方网站http://code.google.com/p/google-api-javascript-client/wiki/Samples#Google_Analytics_API上找到了此示例
有没有办法在没有身份验证的情况下访问Google Analytics数据?我需要以某种方式加载用户名/密码吗?需要说明的是,我希望有一个网站(具有Google Analytics跟踪功能)从自己的帐户加载分析数据.
我认为可能有一种方法可以公开某些数据,然后以某种方式查询...或者可能创建一个有限的用户来访问它.我找不到任何一个例子.
我正在尝试使用最新的PHP客户端API(https://github.com/google/google-api-php-client)检索Google Analytics管理配置文件.
我有以下代码片段:
// we've got the token, so set it
$google_client->setAccessToken($_SESSION['access_code']);
if ($google_client->getAccessToken()) {
$profiles = $google_analytics_service->management_profiles->listManagementProfiles("~all", "~all");
print "<h1>Profiles</h1><pre>" . print_r($profiles, true) . "</pre>";
}
/* $url = 'https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles'; */
/* // json decode as array */
/* $analytics_auth = json_decode($_SESSION['access_code'], true); */
/* $ch = curl_init($url . '?access_token=' . $analytics_auth['access_token']); */
/* curl_exec($ch); */
/* curl_close($ch); */
Run Code Online (Sandbox Code Playgroud)
我得到的错误信息是:
调用GET时出错https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles?key=AIza[SNIP] :( 403)访问未配置
注意:但是我决定使用cURL运行相同的操作,并返回带有配置文件(注释代码)的JSON数组.这是一个错误,还是我?我注意到的是我的access_token以"ya29"开头.
php google-analytics google-api google-analytics-api google-api-php-client
今天我用谷歌搜索"解决"这个问题的生命!
我正在尝试使用服务帐户构建一个非常简单的Google Analytics数据请求控制台应用.我已在Google Developers Console中设置了所有必需的详细信息,但我收到以下错误消息:
An unhandled exception of type 'Google.Apis.Auth.OAuth2.Responses.TokenResponseException'
occurred in Google.Apis.dll
Additional information: Error:"invalid_grant", Description:"", Uri:""
Run Code Online (Sandbox Code Playgroud)
下面是我的控制台应用程序中的代码(隐藏了键):
using System.Security.Cryptography.X509Certificates;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
using Google.Apis.Analytics;
using Google.Apis.Analytics.v3;
using Google.Apis.Analytics.v3.Data;
using System;
namespace GoogleAnalyticsAPI
{
public class Program
{
public static void Main(string[] args)
{
string profileId = "12345678";
string serviceAccountEmail = "123456789abcdefghijklmnopq@developer.gserviceaccount.com";
X509Certificate2 certificate = new X509Certificate2(@"PrivateKey.p12", "mypassword", X509KeyStorageFlags.Exportable);
// Create credentials
ServiceAccountCredential credential = new ServiceAccountCredential(
new ServiceAccountCredential.Initializer(serviceAccountEmail)
{
Scopes = new[] { AnalyticsService.Scope.Analytics }
}.FromCertificate(certificate)); …Run Code Online (Sandbox Code Playgroud) 我正在尝试从JAVA代码访问我的Google Analytics数据.但是当运行以下代码时
package com.test.googleapi;
import java.io.File;
import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.googleapis.javanet.GoogleNetHttpTransport;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.analyticsreporting.v4.AnalyticsReporting;
import com.google.api.services.analyticsreporting.v4.model.DateRange;
import com.google.api.services.analyticsreporting.v4.model.Dimension;
import com.google.api.services.analyticsreporting.v4.model.GetReportsRequest;
import com.google.api.services.analyticsreporting.v4.model.GetReportsResponse;
import com.google.api.services.analyticsreporting.v4.model.Metric;
import com.google.api.services.analyticsreporting.v4.model.ReportRequest;
public class AnalyticsApiTest {
public static void main(String[] args) throws Exception {
GoogleCredential credential = GoogleCredential
.fromStream(new FileInputStream(new File("assets/client-secrets/service-account-key.json")))
.createScoped(Collections.singleton("https://www.googleapis.com/auth/analytics.readonly"));
HttpTransport httpTransport = GoogleNetHttpTransport.newTrustedTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
AnalyticsReporting analyticsReporting = new AnalyticsReporting.Builder(httpTransport, jsonFactory, credential)
.setApplicationName("Test")
.build();
DateRange dateRange = new DateRange(); …Run Code Online (Sandbox Code Playgroud) google-api ×3
php ×3
.net ×1
asp.net ×1
c# ×1
c#-4.0 ×1
facebook ×1
google-apps ×1
javascript ×1