How To Add GTM, Google Analytics Or Other Third Party Scripts In Pofo?
When you want to add <script> tag in header, copy below custom code in your child theme functions.php file or parent theme functions.php file.
<?php if ( ! function_exists( 'pofo_child_header_custom_script' ) ) { function pofo_child_header_custom_script() { ?> <script src="https://example.script.js"></script> <?php } } add_action( 'wp_head', 'pofo_child_header_custom_script' ); ?>
When you want to add <script> tag in footer, copy below custom code in your child theme functions.php file or parent theme functions.php file.
<?php if ( ! function_exists( 'pofo_child_footer_custom_script' ) ) { function pofo_child_footer_custom_script() { ?> <script src="https://example.script.js"></script> <?php } } add_action( 'wp_footer', 'pofo_child_footer_custom_script' ); ?>
Note: We recommend this code customization with child theme for prevent your customization code when parent theme updates.
When you need to add code in <script> tag, you do not need to write any custom code. For that you just need to use additional JS functionality.