Hello,
Is your 'SharePoint Online' Classic or Modern?
If it is classic, a masterpage or add-in level resource should be created.
If it is modern, an SPFx Extension solution should be created with this component.
Should log be written? For what I understand, it will only be a simple 'Accept' or 'Cancel'.