A method for marking, at the outlet of a forming machine using a laser beam, a marking area on hot glass containers laid on a conveying plane (Pc) of a conveyor and running in translation successively past a laser apparatus, the method including the following steps: - determining for each container before its marking, the longitudinal position along the translation direction and a transverse position along a transverse direction relative to the direction of translation of the marking area; - moving, along the transverse direction, the plane of focus of the laser beam as a function of the transverse position of the marking area of each container to optimize the subsequent operation of marking the containers running past the laser beam; - and making on the marking area of each container, a marking along a marking axis (At) by the laser beam whose position of the focus plane has been optimized to ensure the marking, characterized in that, in order to determine the longitudinal position and the transverse position of the marking area of each container it consists in: - positioning a first optical axis of a first light sensor and a second optical axis of a second light sensor in a non-parallel manner to each other, in a detection plane (Pd) parallel to the conveying plane (Pc) and located at a height secant to the marking area, the first optical axis and the second optical axis being located so that each container is caused to cross each optical axis during its translation before the marking, the direction of the optical axes and relative to the direction of displacement and their position relative to the marking axis (At) being known; - detecting the instant of intersection or disengagement, by a container, of the first optical axis and the instant of intersection or disengagement, by a container, of the second optical axis; - and calculating said transverse and longitudinal positions from these instants and in consideration of a known or constant speed of translation (Vt) of the containers; - the method consisting in determining, from the determination of the longitudinal position of the marking area, the marking instant for each container running past the laser apparatus. - determining for each container before its marking, the longitudinal position along the translation direction and a transverse position along a transverse direction relative to the direction of translation of the marking area; - moving, along the transverse direction, the plane of focus of the laser beam as a function of the transverse position of the marking area of each container to optimize the subsequent operation of marking the containers running past the laser beam; - and making on the marking area of each container, a marking along a marking axis (At) by the laser beam whose position of the focus plane has been optimized to ensure the marking, - positioning a first optical axis of a first light sensor and a second optical axis of a second light sensor in a non-parallel manner to each other, in a detection plane (Pd) parallel to the conveying plane (Pc) and located at a height secant to the marking area, the first optical axis and the second optical axis being located so that each container is caused to cross each optical axis during its translation before the marking, the direction of the optical axes and relative to the direction of displacement and their position relative to the marking axis (At) being known; - detecting the instant of intersection or disengagement, by a container, of the first optical axis and the instant of intersection or disengagement, by a container, of the second optical axis; - and calculating said transverse and longitudinal positions from these instants and in consideration of a known or constant speed of translation (Vt) of the containers; - the method consisting in determining, from the determination of the longitudinal position of the marking area, the marking instant for each container running past the laser apparatus.