coresocial-sharing-qrcode
This content is intended for WordPress developers, and it may require coding knowledge of WordPress, PHP, and JavaScript. Code examples provided here may contain errors or needs some additional coding. Make sure to test the code before using it on a live website!
Action identifier (JavaScript)
Arguments
JavaScript wp.hooks action in coreSocial Pro. Fires after the QR overlay is appended to the document, provided the kjua library is available. Tracking is initiated separately and is not awaited.
The overlay contains an SVG QR code. This event reports display of that overlay, not scanning of the QR code or successful sharing. No event is emitted from this path when kjua is unavailable.
Register with wp.hooks.addAction(), not PHP add_action(). Load the listener with the wp-hooks script dependency before the relevant user interaction. The Source Code block uses its generic action template; the code example shows the actual JavaScript API.
Example
wp.hooks.addAction( 'coresocial-sharing-qrcode', 'my-site/qr-observer', function ( link ) {
const overlay = document.getElementById( 'coresocial-overlay-wrapper' );
console.log( 'QR overlay ready:', Boolean( overlay ) );
} );