Skip to content

Instantly share code, notes, and snippets.

@BFTrick

BFTrick/heap.php

Last active Nov 4, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.