我可以从 Apps 脚本中调用 Multi Channel Funnel mcf 吗?
Can I call the Multi Channel Funnel mcf from within Apps script?
我正在学习 this 教程并开始工作。
然后我尝试对其进行编辑以从 Google Analytics 多渠道漏斗中获取数据:
这使用核心报告 api (Analytics.Data.Ga.get(...
)
function getReportDataForProfile(profile) { // 我之前定义了我的个人资料 id
var startDate = getLastNdays(750); // 2 weeks (a fortnight) ago.
var endDate = getLastNdays(0); // Today.
var optArgs = {
'dimensions': 'ga:medium', // Comma separated list of dimensions.
'start-index': '1',
'max-results': '10000' // Display the first 10000 results.
//'sampling-level': 'higher-precision',
};
// Make a request to the API.
var results = Analytics.Data.Ga.get( // mcf for multi channel api, Ga for core
profile, // Table id (format ga:xxxxxx).
startDate, // Start-date (format yyyy-MM-dd).
endDate, // End-date (format yyyy-MM-dd).
'ga:sessions', // Comma seperated list of metrics.
optArgs);
if (results.getRows()) {
return results;
} else {
throw new Error('No views (profiles) found');
}
}
该块在教程中略有编辑,但按预期工作 - 我获得了数据。我试图修改它以从 mcf:
获取数据
这不起作用。为什么不呢?
function getReportDataForProfile(profile) {
var startDate = getLastNdays(750); // 2 weeks (a fortnight) ago.
var endDate = getLastNdays(0); // Today.
var optArgs = {
'dimensions': 'mcf:medium', // Comma separated list of dimensions.
'start-index': '1',
'max-results': '10000' // Display the first 10000 results.
//'sampling-level': 'higher-precision',
};
// Make a request to the API.
var results = Analytics.Data.mcf.get( // mcf for multi channel api, Ga for core
profile, // Table id (format ga:xxxxxx).
startDate, // Start-date (format yyyy-MM-dd).
endDate, // End-date (format yyyy-MM-dd).
'mcf:firstInteractionConversions', // Comma seperated list of metrics.
optArgs);
if (results.getRows()) {
return results;
} else {
throw new Error('No views (profiles) found');
}
}
我想你用的是 mcf 而不是 Mcf:
var results = Analytics.Data.Mcf.get
希望对您有所帮助。
我正在学习 this 教程并开始工作。
然后我尝试对其进行编辑以从 Google Analytics 多渠道漏斗中获取数据:
这使用核心报告 api (Analytics.Data.Ga.get(...
)
function getReportDataForProfile(profile) { // 我之前定义了我的个人资料 id
var startDate = getLastNdays(750); // 2 weeks (a fortnight) ago.
var endDate = getLastNdays(0); // Today.
var optArgs = {
'dimensions': 'ga:medium', // Comma separated list of dimensions.
'start-index': '1',
'max-results': '10000' // Display the first 10000 results.
//'sampling-level': 'higher-precision',
};
// Make a request to the API.
var results = Analytics.Data.Ga.get( // mcf for multi channel api, Ga for core
profile, // Table id (format ga:xxxxxx).
startDate, // Start-date (format yyyy-MM-dd).
endDate, // End-date (format yyyy-MM-dd).
'ga:sessions', // Comma seperated list of metrics.
optArgs);
if (results.getRows()) {
return results;
} else {
throw new Error('No views (profiles) found');
}
}
该块在教程中略有编辑,但按预期工作 - 我获得了数据。我试图修改它以从 mcf:
获取数据这不起作用。为什么不呢?
function getReportDataForProfile(profile) {
var startDate = getLastNdays(750); // 2 weeks (a fortnight) ago.
var endDate = getLastNdays(0); // Today.
var optArgs = {
'dimensions': 'mcf:medium', // Comma separated list of dimensions.
'start-index': '1',
'max-results': '10000' // Display the first 10000 results.
//'sampling-level': 'higher-precision',
};
// Make a request to the API.
var results = Analytics.Data.mcf.get( // mcf for multi channel api, Ga for core
profile, // Table id (format ga:xxxxxx).
startDate, // Start-date (format yyyy-MM-dd).
endDate, // End-date (format yyyy-MM-dd).
'mcf:firstInteractionConversions', // Comma seperated list of metrics.
optArgs);
if (results.getRows()) {
return results;
} else {
throw new Error('No views (profiles) found');
}
}
我想你用的是 mcf 而不是 Mcf:
var results = Analytics.Data.Mcf.get
希望对您有所帮助。