gpt4 book ai didi

javascript - Azure Application Insights - 在 Javascript 中具有自定义属性的 trackEvent

转载 作者:行者123 更新时间:2023-12-03 00:45:43 25 4
gpt4 key购买 nike

我们正在使用客户端 javascript SDK(通过 snippet-based 集成)来获取 Application Insights track custom events

appInsights.trackEvent({name:"WinGame"});

如何向其中添加自定义属性?像这样的东西?!

appInsights.trackEvent({name:"WinGame", customProperties:{gameName:"Game 1", player:"my player 1"}});

最佳答案

JS Azure appinsights github page 上所示:

Custom properties can be included in your telemetry through theproperties named argument. This can be done with any of the TrackAPIs.

appInsights.trackEvent({   
name: 'some event',
properties: { // accepts any type
prop1: 'string',
prop2: 123.45,
prop3: { nested: 'objects are okay too' }
}
});

关于javascript - Azure Application Insights - 在 Javascript 中具有自定义属性的 trackEvent,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66583043/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com