forked from TailorBrands/ember-cli-heap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
12 lines (10 loc) · 1008 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
/* eslint-env node */
'use strict';
module.exports = {
name: 'ember-cli-heap',
contentFor: function(type, config) {
if (type === 'head-footer' && config.heap && !config.heap.development && config.heap.projectId) {
return '<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("' + config.heap.projectId + '");</script>';
}
}
};