Where to insert the purchase code for viewing ads

have a code to show ads. After I add the game to Yandex games, I need to add code in the game. When you click on the button, show an advertisement. Tell me how and where to insert the code by clicking on the button to view the advertisement. Here is the code
callbacks: {
onOpen: () => {
console.log(‘Video ad open.’);
onRewarded: () => {
onClose: () => {
console.log(‘Video ad closed.’);
onError: (e) => {
console.log(‘Error while open video ad:’, e);

Just use the Yandex extension.