ApplicationInsights-JS icon indicating copy to clipboard operation
ApplicationInsights-JS copied to clipboard

[BUG] parentId is not_specified when it's defined on a parent element in DOM

Open krystofmatejka opened this issue 1 year ago • 1 comments

Description/Screenshot

I have copied example 3 from the documentation, but parentId attribute is not_specified.

image

image

Steps to reproduce

  • go to playground https://codepen.io/krystof-matejka/pen/LYoYBQw
  • replace connectionString on line 21

Environment

  • OS/Browser: Edge
  • SDK Version [e.g. 22]: @microsoft/applicationinsights-clickanalytics-js: 3.2.0
  • How you initialized the SDK: npm

Expected behavior

I expect that parentId is test6parent as the documentation says.

Additional context Add any other context about the problem here.

krystofmatejka avatar May 10 '24 09:05 krystofmatejka

please try the following

  1. parentElement.setAttribute("data-parentid", "testParentId"); or
  2. set parentDataTag:"parentgroup" under clickanalytics plugin config, set parentElement.setAttribute("data-parentgroup", "testParentGroup"); and let us know if any of these works!

Karlie-777 avatar May 10 '24 23:05 Karlie-777

hello @Karlie-777 first solution does not work, but the second does! thanks 🙇

krystofmatejka avatar May 14 '24 06:05 krystofmatejka

i see what i did wrong, i haven't copied parentDataTag: "group" from the example. so there isn't any issue

krystofmatejka avatar May 14 '24 07:05 krystofmatejka