我正在尝试将数据从Angular指令推入google标记管理器脚本。我希望在Google Analytics(分析)中使用此数据。我使用datalayer.push方法向GTM发送我的自定义事件。
<span style="display: block" *ngFor="let r of option_rg">
<input type="radio" name="rg_radio" [value]="r.value"[(ngModel)]="a"
onclick="dataLayer.push({'event' : 'custom event','dataToBeIncluded' : r.label });"/>
{{r.label}}
</span>
````
The event works by itself,yet if I want to have the variable 'dataToBeIncluded' with the data from
the control it does not work.
How can I use component properties in Angular to work with Google Tag Manager's dataLayer.push method?