Created
May 23, 2018 13:22
-
-
Save cinghaman/6292b52bc9d1d575cf688bf0e9113221 to your computer and use it in GitHub Desktop.
WordPress Plugin Default code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Scripts to Head | |
* Plugin URI: https://thepartytraveller.com | |
* Description: Add Scripts to head without any other noise | |
* Version: 1.0 | |
* Author: Robin | |
* Author URI: https://thepartytraveller.com | |
*/ | |
function as_code_to_header() { | |
?> | |
<script async src="https://www.googletagmanager.com/gtag/js?id=XX-XX-XXXX"></script> | |
<script> | |
window.dataLayer = window.dataLayer || []; | |
function gtag(){dataLayer.push(arguments);} | |
gtag('js', new Date()); | |
gtag('config', 'XX-XXX-XX', { 'anonymize_ip': true, 'ALLOW_DISPLAY_FEATURES': FALSE }); | |
</script> | |
<?php | |
} | |
add_action( 'wp_head', 'as_code_to_header' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment