Untitled

 avatar
unknown
plain_text
21 days ago
1.3 kB
6
Indexable
function enqueue_custom_script_for_specific_page() {
    // Check if the current page matches the specific URL path
    if ($_SERVER['REQUEST_URI'] === '/membership-account/membership-confirmation') {
        ?>
        <script> 
            window.clickmagick_cmc = {
                uid: '204244',
                hid: '3383680547',
                cmc_project: 'FreeFiltering',
                vid_info: 'on',
            };
        </script>
        <script src='//omni.freefiltering.org/5fc85343.js'></script>
        <script defer>
            document.addEventListener('DOMContentLoaded', function () {
                const amountElement = document.querySelector('td[data-title="Total"]');
                if (amountElement) {
                    const amount = amountElement.textContent.trim();
                    clickmagick_cmc.log('s', 'initial_sale', amount, 'FreeFiltering');
                    console.log(`Logged amount: ${amount} with clickmagick_cmc.log`);
                } else {
                    console.error('Amount element not found: td[data-title="Total"]');
                }
            });
        </script>
        <?php
    }
}
add_action('wp_footer', 'enqueue_custom_script_for_specific_page');
Leave a Comment