Skip to content

Commit 69d9634

Browse files
author
Vikas Agarwal
committed
Parameterized the heap analytics script
1 parent 151fbdf commit 69d9634

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

src/config/constants.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,6 @@ export const CODER_BOT_USER_LNAME = 'Bot'
212212

213213
export const PROJECT_MAX_COLORS = 5
214214

215-
export const AUTOCOMPLETE_TRIGGER_LENGTH = 3
215+
export const AUTOCOMPLETE_TRIGGER_LENGTH = 3
216+
217+
export const HEAP_ANALYTICS_APP_ID = process.env.HEAP_ANALYTICS_APP_ID || '4153837120'

src/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
88
<base href="/">
99
<script type="text/javascript">
10-
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])};
11-
heap.load("4153837120");
1210
</script>
1311
</head>
1412
<body>

src/index.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@ import Router from 'react-router/lib/Router'
88
import store from './config/store'
99
import routes from './routes'
1010
import { TCEmitter } from './helpers'
11-
import { EVENT_ROUTE_CHANGE } from './config/constants'
11+
import { EVENT_ROUTE_CHANGE, HEAP_ANALYTICS_APP_ID } from './config/constants'
1212

1313
const mountNode = document.getElementById('root')
1414
const onRouteChange = () => {
1515
TCEmitter.emit(EVENT_ROUTE_CHANGE, window.location.pathname)
1616
}
1717

18+
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])};
19+
heap.load(HEAP_ANALYTICS_APP_ID);
20+
1821
render((
1922
<Provider store={store}>
2023
<Router history={browserHistory} routes={routes} onUpdate={onRouteChange} />

0 commit comments

Comments
 (0)