Obtener la posición del componente JavaScript

let elem = document.getElementById('id_my_component');
let rect = elem.getBoundingClientRect();
console.log("x: "+ rect.x);
console.log("y: "+ rect.y);
Cerbrain