Positioning an object on a marker location using AR.js

Hi everyone, happy 2022!
I’m working on a project using marker-based AR.js. I want to position objects to stay where the marker was detected (to add to scene, so they stay at that position even after the marker was lost). Something like in this example: three.js examples - but instead of webXR API I want to use AR.js, and instead of touch event, I want to use the event of a marker.
But for some reason when I apply the matrixWorld of the marker to the object, the object still moves and sticks to the screen.
Does anyone know how to approach this?
Thank you so much!