This page demonstrates how Reader Registration CTAs work with automatic invocation. Refer to the Developer documentation for more information.
The CTA should appear automatically on this page.
Reader Registration allowing publishers to display a dialog for users to register. This is similar to a Custom CTA but specifically tailored for registration flows.
To use this feature:
configurationId or by type TYPE_REGISTRATION_WALL.To configure Reader Registration CTAs, swg.js must first be initialized. These examples demonstrate using the library in manual mode.
To invoke a Reader Registration CTA, the publisher can use the subscriptions.getAvailableInterventions() method from the initialized swg.js library to fetch the configuration.
const availableInterventions = await subscriptions.getAvailableInterventions();
const cta = availableInterventions.find(({type}) => {
return type === 'TYPE_REGISTRATION_WALL';
});
To display the CTA, use the returned value and invoke the show method.
cta?.show({
isClosable: true,
onResult: (response) => {
console.log(response.data); // you can retrieve the user information here
return true;
}
});