Syntax
newrelic.interaction().getContext(function $callback)
Stores values for the current SPA interaction asynchronously in browser.
Requirements
Agent version nr-963 or higher.
Description
This API method takes a callback that will be invoked asynchronously with the context object associated with the current interaction. Use this for aggregating data associated with the current interaction. These values can be used in other parts of your code.
This context is also provided by the onEnd call.
Parameters
Parameter | Description |
---|---|
function | Required. A function that accepts the interaction context object as its only argument. |
Return values
This method returns the same API object created by interaction()
.
Examples
router.addRoute('/products/{productId}', params => { newrelic.interaction().getContext(ctx => ctx.productId = params.productId) renderProduct(params.productId) updateHash()})
window.addEventListener('hashchange', (ev) => { const interaction = newrelic.interaction() interaction.getContext(ctx => { if (ctx.productId) { interaction.setAttribute('productId', ctx.productId) } })})
その他のヘルプ
さらに支援が必要な場合は、これらのサポートと学習リソースを確認してください:
- Explorers Hubでは、コミュニティからのサポートを受けたり、ディスカッションに参加したりすることができます。
- 当社サイトで答えを見つけて、サポートポータルの使用方法を確認してください。
- Linux、Windows、およびmacOS向けトラブルシューティングツールであるNew Relic Diagnosticsを実行してください。
- New Relicの とandドキュメント をご確認ください。