Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active November 4, 2016 14:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BFTrick/bb3b3b0e0497e8adecfa00e3c8e1b33d to your computer and use it in GitHub Desktop.
Save BFTrick/bb3b3b0e0497e8adecfa00e3c8e1b33d to your computer and use it in GitHub Desktop.
Load Heap Analytics
<?php
/*
* Plugin Name: Heap Analytics
* Plugin URI: https://gist.github.com/BFTrick/bb3b3b0e0497e8adecfa00e3c8e1b33d
* Description: Send all site data to Heap Analytics
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com
* Version: 1.0
*/
// load heap analytics
add_action('wp_head','patricks_load_heap_analytics', 30);
function patricks_load_heap_analytics() {
?>
<script type="text/javascript">
window.heap=window.heap||[],heap.load=function(e,t){window.heap.appid=e,window.heap.config=t=t||{};var r=t.forceSSL||"https:"===document.location.protocol,a=document.createElement("script");a.type="text/javascript",a.async=!0,a.src=(r?"https:":"http:")+"//cdn.heapanalytics.com/js/heap-"+e+".js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(a,n);for(var o=function(e){return function(){heap.push([e].concat(Array.prototype.slice.call(arguments,0)))}},p=["addEventProperties","addUserProperties","clearEventProperties","identify","removeEventProperty","setEventProperties","track","unsetEventProperty"],c=0;c<p.length;c++)heap[p[c]]=o(p[c])};
heap.load("278165378");
</script>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment