我刚开始使用Tealium。我正在尝试将Tealium标记合并到最后一个登录信息中。我该怎么做?以下是代码:
最后登录日期的HTML组件
S-component.html
<div #greeting class="greeting-message">
<ng-container *ngIf="userProfile$ | async as userProfile">
<h1 qa-name="greetingMessage">
Good {{ timeOfDay }},
{{ userProfile.displayName || userProfile.firstName || '' }}
</h1>
<p *ngIf="userProfile.lastLoginDate" qa-name="lastLoggedIn">
You last logged in at
{{
userProfile.lastLoginDate | date: "h:mm:ssaaaaa'm' on MMMM d, y"
}}
</p>
<p *ngIf="!userProfile.lastLoginDate">
Welcome!
</p>
</ng-container>
</div>下面是用户配置文件界面
i-user-profile.ts
export interface IUserProfile {
lastLoginDate?: Date
}下面是类型记录组件,它包含用户登录的时间和时间。
S-component.ts
import {
IUserProfile
} from '@shared/interfaces';
import {
TealiumService
} from '@shared/services';
export class SComponent implements OnInit {
private static getTimeOfDay(hour: number): TimeOfDay;
public ngOnInit() {
this.timeOfDay = AccountSummaryComponent.getTimeOfDay(
new Date().getHours()
);
}
constructor(
private readonly _tealiumService: TealiumService,
private readonly _userService: UserService
) {
this.userProfile$ = this._userService.profileChanges();
this.timeOfDay = SComponent.getTimeOfDay(
new Date().getHours()
);
}
}发布于 2020-06-06 15:46:33
如果您想将数据传递到Tealium,那么您有几个不同的选项。您需要确保您的页面已经包含Tealium标记,详细说明如何添加可以在[医]泰勒姆氏病证中找到的内容。如果您使用服务器端产品,那么您可以创建一个保存最后登录日期的访问者属性,这可以在仪表板中完成,而无需修改代码。
如果您只使用客户端产品,那么需要将userProfile.lastLoginDate变量添加到页面上的utag_data对象中。当进行utag.view()调用时,这些数据将被传递到Tealium。您需要添加的代码的相关部分在加载utag.js文件之前的脚本中。在前面的链接中有更多有关这方面的信息。
https://stackoverflow.com/questions/62221354
复制相似问题