-
-
Save maciejbis/88010dc6f02dfec1f707513b7db1b754 to your computer and use it in GitHub Desktop.
A barebone plugin that allows you to add custom code snippets to your WordPress website
This file contains 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: My custom code snippets | |
* Plugin URI: https://permalinkmanager.pro/ | |
* Description: A barebone plugin that allows you to add custom code snippets to your WordPress website | |
* Version: 1.0.0 | |
* Author: Maciej Bis | |
* Author URI: http://maciejbis.net/ | |
* License: GPL-2.0+ | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt | |
* Domain Path: /languages | |
*/ | |
/** | |
* [Add Google Analytics Tracking] | |
* This is only an example snippet, you are free to remove the below function. | |
*/ | |
function bis_add_google_analytics_code() { | |
?> | |
<!-- Google Analytics --> | |
<script> | |
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ | |
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), | |
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) | |
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); | |
ga('create', 'UA-XXXXX-Y', 'auto'); | |
ga('send', 'pageview'); | |
</script> | |
<!-- End Google Analytics --> | |
<?php | |
} | |
add_action( 'wp_footer', 'bis_add_google_analytics_code' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment