ディスカッション
NetSuiteの保存検索やレポートをマスターするための究極のガイドである分析センターを使用して、データの力を最大限に活用しましょう。複雑さを単純化し、組織の真の可能性を解き放ちます。今すぐ分析センターに参加して、新たな高みを目指しましょう!
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Keep an eye out for upcoming NetSuite events, including meetups, workshops, and webinars. These sessions are a great way to connect with peers, learn from experts, and stay current on the latest NetSuite updates and best practices. Registration links are provided in each event.
SuiteletsにGoogleアナリティクスを追加する
適用
製品: 2019.1
シナリオ
SuiteletにGoogleアナリティクスを追加したい
解決策
Google Analyticsを有効化/Webページに追加するには、Googleが提供するJavaScriptコードをヘッダーまたはHTMLページの本文に含める必要があります。以下に、インラインHTMLフィールドを使用してGoogle Analyticsコードをスイートに含める方法のサンプルを示します。
function suitelet(request, response)
{
// フォームを作成
var form = nlapiCreateForm('My SuiteLet');
// Googleアナリティクスコードをフォームに追加
addGoogleAnalytics(form)
// フォームをレンダリングする
response.writePage( form );
}
function addGoogleAnalytics(form)
{
// インラインHTMLフィールドを作成
var fld = form.addField('custpage_google_analytics', 'inlinehtml');
// スクリプトを作成
var script = "<.script type='text/javascript'>";
script += "var _gaq = _gaq || [];";
script += "_gaq.push(['_setAccount', 'UA-XXXXX-X']);";
script += "_gaq.push(['_trackPageview']);";
script += "(function() {";
script += "var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;";
script += "ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';";
script += "var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
タグ付けされた:
0