首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Tealium标签(谷歌分析)

Tealium标签(谷歌分析)
EN

Stack Overflow用户
提问于 2020-06-05 17:48:19
回答 1查看 283关注 0票数 0

我刚开始使用Tealium。我正在尝试将Tealium标记合并到最后一个登录信息中。我该怎么做?以下是代码:

最后登录日期的HTML组件

S-component.html

代码语言:javascript
复制
<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

代码语言:javascript
复制
export interface IUserProfile {
  lastLoginDate?: Date
}

下面是类型记录组件,它包含用户登录的时间和时间。

S-component.ts

代码语言:javascript
复制
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()
  );
 }
}
EN

回答 1

Stack Overflow用户

发布于 2020-06-06 15:46:33

如果您想将数据传递到Tealium,那么您有几个不同的选项。您需要确保您的页面已经包含Tealium标记,详细说明如何添加可以在[医]泰勒姆氏病证中找到的内容。如果您使用服务器端产品,那么您可以创建一个保存最后登录日期的访问者属性,这可以在仪表板中完成,而无需修改代码。

如果您只使用客户端产品,那么需要将userProfile.lastLoginDate变量添加到页面上的utag_data对象中。当进行utag.view()调用时,这些数据将被传递到Tealium。您需要添加的代码的相关部分在加载utag.js文件之前的脚本中。在前面的链接中有更多有关这方面的信息。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62221354

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档