If this is on a specific page you’ll be able to exclude the page from being cached under Performance > Page Cache > Advanced.
If it’s on every page you’ll have to enable fragment caching. Set the method to Disk: Basic and enable Late Initialization in Performance > Page Cache > Advanced. Set the following constant in your wp-config.php
:
define( 'W3TC_DYNAMIC_SECURITY', md5( rand( 0, 999999 ) ) );
Then wrap any sections you don’t want cached like so:
<!--mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->
<?php // your dynamic button code here ?>
<!--/mfunc <?php echo W3TC_DYNAMIC_SECURITY; ?> -->