Automatically Switch between two AdSense accounts based on the author post


We are two managers for one website , each of us have an AdSense account

Can our ad code display in the articles we write, based on the author slug or id?

I tried to use this code in head section , but it did not work :

<?php if (is_author('author 1');) : ?> <script data-ad-client="ca-pub-ءءءءء1ءءءء" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>; <?php else : ?> <script data-ad-client="ca-pub-ءءءءء2ءءءء" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <?php endif; ?>

any ideas to switch automatically between the accounts, not as a revenue share.