• ๋กœ๊ทธ์ธ์ง€๊ธˆ ์‹œ์ž‘ํ•˜๊ธฐ

์‚ฌ์šฉ์ž์˜ ํŽธ์˜๋ฅผ ์œ„ํ•ด ์ œ๊ณต๋˜๋Š” ๊ธฐ๊ณ„ ๋ฒˆ์—ญ์ž…๋‹ˆ๋‹ค.

์˜๋ฌธ๋ณธ๊ณผ ๋ฒˆ์—ญ๋ณธ์ด ์ผ์น˜ํ•˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ ์˜๋ฌธ๋ณธ์ด ์šฐ์„ ํ•ฉ๋‹ˆ๋‹ค. ๋ณด๋‹ค ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๋ฅผ ๋ฐฉ๋ฌธํ•˜์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

๋ฌธ์ œ ์‹ ๊ณ 

getContext(SPA API)

์ค‘์š”

์ด API๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด ๋ธŒ๋ผ์šฐ์ € ์—์ด์ „ํŠธ์˜ Browser Pro+SPA ๋ฒ„์ „์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

ํ†ต์‚ฌ๋ก 

newrelic.interaction().getContext(function $callback)

ํ˜„์žฌ SPA ์ƒํ˜ธ ์ž‘์šฉ์— ๋Œ€ํ•œ ๊ฐ’์„ ๋ธŒ๋ผ์šฐ์ €์— ๋น„๋™๊ธฐ์ ์œผ๋กœ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

์š”๊ตฌ ์‚ฌํ•ญ

์—์ด์ „ํŠธ ๋ฒ„์ „ nr-963 ์ด์ƒ์ž…๋‹ˆ๋‹ค.

์„ค๋ช…

์ด API ๋ฉ”์„œ๋“œ๋Š” ํ˜„์žฌ ์ƒํ˜ธ ์ž‘์šฉ๊ณผ ์—ฐ๊ฒฐ๋œ ์ปจํ…์ŠคํŠธ ๊ฐœ์ฒด์™€ ๋น„๋™๊ธฐ์ ์œผ๋กœ ํ˜ธ์ถœ๋˜๋Š” ์ฝœ๋ฐฑ์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ˜„์žฌ ์ƒํ˜ธ ์ž‘์šฉ๊ณผ ๊ด€๋ จ๋œ ๋ฐ์ดํ„ฐ๋ฅผ ์ง‘๊ณ„ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด ๊ฐ’์€ ์ฝ”๋“œ์˜ ๋‹ค๋ฅธ ๋ถ€๋ถ„์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

์ด ์ปจํ…์ŠคํŠธ๋Š” onEnd ํ˜ธ์ถœ์—์„œ๋„ ์ œ๊ณต๋ฉ๋‹ˆ๋‹ค.

๋งค๊ฐœ๋ณ€์ˆ˜

๋งค๊ฐœ๋ณ€์ˆ˜

์„ค๋ช…

$callback

๊ธฐ๋Šฅ

ํ•„์ˆ˜์˜. ์ƒํ˜ธ์ž‘์šฉ ์ปจํ…์ŠคํŠธ ๊ฐ์ฒด๋ฅผ ์œ ์ผํ•œ ์ธ์ˆ˜๋กœ ๋ฐ›์•„๋“ค์ด๋Š” ํ•จ์ˆ˜.

๋ฐ˜ํ™˜ ๊ฐ’

์ด ๋ฉ”์„œ๋“œ๋Š” interaction() ์—์„œ ์ƒ์„ฑํ•œ ๊ฒƒ๊ณผ ๋™์ผํ•œ API ๊ฐ์ฒด๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

์˜ˆ

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);
}
});
});
Copyright ยฉ 2023 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.