microsoft-clarity
Last commit date
js
6 months ago
LICENSE.txt
5 years ago
agents.php
6 months ago
clarity-hooks.php
1 year ago
clarity-page.php
6 months ago
clarity-server-analytics.php
7 months ago
clarity.php
6 months ago
index.php
5 years ago
readme.txt
6 months ago
agents.php
47 lines
| 1 | <?php |
| 2 | |
| 3 | /******************************************************************************* |
| 4 | * File with agents helper functions |
| 5 | *******************************************************************************/ |
| 6 | |
| 7 | /** |
| 8 | * Check if script should be injected on current page |
| 9 | */ |
| 10 | function should_inject_brand_agents_script() { |
| 11 | // Inject on WooCommerce pages |
| 12 | if ( function_exists( 'is_woocommerce' ) && is_woocommerce() ) { |
| 13 | return true; |
| 14 | } |
| 15 | |
| 16 | // Inject on shop page |
| 17 | if ( function_exists( 'is_shop' ) && is_shop() ) { |
| 18 | return true; |
| 19 | } |
| 20 | |
| 21 | // Inject on product pages |
| 22 | if ( function_exists( 'is_product' ) && is_product() ) { |
| 23 | return true; |
| 24 | } |
| 25 | |
| 26 | // Inject on cart page |
| 27 | if ( function_exists( 'is_cart' ) && is_cart() ) { |
| 28 | return true; |
| 29 | } |
| 30 | |
| 31 | // Inject on checkout page |
| 32 | if ( function_exists( 'is_checkout' ) && is_checkout() ) { |
| 33 | return true; |
| 34 | } |
| 35 | |
| 36 | // Inject on account pages |
| 37 | if ( function_exists( 'is_account_page' ) && is_account_page() ) { |
| 38 | return true; |
| 39 | } |
| 40 | |
| 41 | // Inject on homepage if it's the shop |
| 42 | if ( is_front_page() && get_option( 'show_on_front' ) === 'page' && get_option( 'page_on_front' ) == wc_get_page_id( 'shop' ) ) { |
| 43 | return true; |
| 44 | } |
| 45 | |
| 46 | return false; |
| 47 | } |