此插件由 Adobe Consulting 团队提供,旨在帮助您从 Adobe Analytics 中获取更多的价值。Adobe 客户关怀团队不提供对此插件的支持,包括安装或疑难解答。如果您需要关于此插件的帮助,请与您组织的 Adobe 客户团队联系。他们可为您安排与顾问会面以寻求帮助。
getTimeParting
插件允许您捕获网站上发生任何可衡量活动的详细时间。如果您希望按任一可重复分时段对指定日期范围内的量度进行细分,此插件将非常有帮助。例如,您可以比较一周内某两天的转化率,如所有星期日的转化率与所有星期四的转化率。您还可以比较一天内的不同时段,如比较所有上午与所有晚上。
Analysis Workspace 提供了与此插件类似的开箱即用维度,只是维度的格式略有不同。有关更多信息,请参阅《Analytics 用户指南》中的时间划分维度。有些组织发现 Analysis Workspace 提供的开箱即用维度足以满足其需求。
此插件的 4.0+ 版本与以往版本有显著差异。Adobe 强烈建议您“从头开始”实施此插件。引用了版本 4.0 之前插件的代码与此插件的当前版本不兼容。
Adobe提供了一个扩展,允许您将最常用的插件与Web SDK结合使用。
getTimeParting
Time Zone
参数。尚不支持在Web SDK的手动实施中使用此插件。
Adobe提供了一个扩展,允许您将最常用的插件与Adobe Analytics一起使用。
如果您不想使用“常用Analytics插件”插件扩展,则可以使用自定义代码编辑器。
在实例化(使用 s_gi
)Analytics 跟踪对象后,将以下代码复制并粘贴到 AppMeasurement 文件中的任意位置。在您的实施中保留代码的注释和版本号可帮助 Adobe 对任何潜在问题进行疑难解答。
/******************************************* BEGIN CODE TO DEPLOY *******************************************/
/* Adobe Consulting Plugin: getTimeParting v6.3 (No Prerequisites Needed) */
function getTimeParting(t){var c=t;if("-v"===t)return{plugin:"getTimeParting",version:"6.3"};a:{if("undefined"!==typeof window.s_c_il){var a=0;for(var b;a<window.s_c_il.length;a++)if(b=window.s_c_il[a],b._c&&"s_c"===b._c){a=b;break a}}a=void 0}"undefined"!==typeof a&&(a.contextData.getTimeParting="6.3");c=document.documentMode?void 0:c||"Etc/GMT";a=(new Date).toLocaleDateString("en-US",{timeZone:c,minute:"numeric",hour:"numeric",weekday:"long",day:"numeric",year:"numeric",month:"long"});a=/([a-zA-Z]+).*?([a-zA-Z]+).*?([0-9]+).*?([0-9]+)(.*?)([0-9])(.*)/.exec(a);return"year="+a[4]+" | month="+a[2]+" | date="+a[3]+" | day="+a[1]+" | time="+(a[6]+a[7])};
/******************************************** END CODE TO DEPLOY ********************************************/
getTimeParting
函数使用以下参数:
t
(可选但建议使用的字符串):要将访客的本地时间转换到的时区的名称。默认为 UTC/GMT 时间。请参阅维基百科上的 TZ 时区数据库所含时区列表,以获取有效值的完整列表。
常见有效值包括:
"America/New_York"
(表示东部时间)"America/Chicago"
(表示中部时间)"America/Denver"
(表示山地时间)"America/Los_Angeles"
(表示太平洋时间)调用此函数将返回一个字符串,其中包含以竖线 (|
) 分隔的以下项:
// Use the following code if the visitor resides in Paris, France
s.eVar8 = getTimeParting("Europe/Paris");
// Use the following code if the visitor resides in San Jose, California
s.eVar17 = getTimeParting("America/Los_Angeles");
// Use the following code if the visitor resides in Ghana.
// Note that Ghana is in GMT time, the default time zone that the plug-in uses with no argument
s.eVar22 = getTimeParting();
// Internet Explorer only returns the visitor's local time. Use this conditional statement to accommodate IE visitors
if(!document.documentMode) s.eVar39 = getTimeParting("America/New_York");
else s.eVarX = "Internet Explorer Visitors";
// Given a visitor from Denver Colorado visits a site on August 31, 2020 at 9:15 AM
// Returns the string value "year=2020 | month=August | date=31 | day=Friday | time=6:15 PM"
s.eVar10 = getTimeParting("Europe/Athens");
// Returns the string value "year=2020 | month=August | date=31 | day=Friday | time=6:15 AM"
s.eVar11 = getTimeParting("America/Nome");
// Returns the string value "year=2020 | month=August | date=31 | day=Friday | time=8:45 PM"
s.eVar12 = getTimeParting("Asia/Calcutta");
// Returns the string value "year=2020 | month=September | date=1 | day=Saturday | time=1:15 AM"
s.eVar13 = getTimeParting("Australia/Sydney");
tpDST
参数。此插件的早期版本无法在将来的所有年份中使用。如果您使用此插件的早期版本,Adobe 强烈建议升级到最新版本,以避免 JavaScript 错误和数据丢失。如果无法升级此插件,请确保插件代码中的 s._tpdst
变量包含适当的将来年份。