0
Reactアプリケーションでヒープ解析を設定しようとしています。私はindex.js(カスタムindex.htmlなし)を持っています。Reactのindex.jsでウィンドウ変数の宣言が機能しない
この説明では、スクリプトを頭のタグの間に置く必要があると言います。私は私の場合、index.jsでやっていると思います。
これはスクリプトです:
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(MY_APP_ID);
はしかし、heap is not defined error
がアップします。
私は代わりに何をしていますか?
htmlを使用していない場合、どのようにブラウザに読み込まれますか? –
index.jsコードを提供できますか? – assembler