我是使用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-组件.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()
);
}
}