このプラグインはアドビコンサルティングによって提供されており、Adobe Analytics からより多くの価値を引き出すのに役立ちます。アドビカスタマーケアは、インストールやトラブルシューティングを含め、このプラグインに対するサポートをおこないません。このプラグインに関するヘルプが必要な場合は、貴社のアカウントマネージャーにお問い合わせになって、担当コンサルタントとのミーティングを手配してもらってください。
addProductEvar
プラグインを使用すると、既に存在する製品変数の内容が変更、移動、削除されるかどうかを気にすることなく、製品構文を使用する Adobe Analytics マーチャンダイジング eVar を products 変数に簡単に追加できます。製品構文マーチャンダイジング eVar を簡単に products
変数に追加するには、このプラグインを使用することをお勧めします。製品構文でマーチャンダイジング eVar を使用しない場合は、addProductEvar
プラグインを使用する必要はありません。
このプラグインは、製品エントリに既に存在する eVar を置き換えません。このプラグインを使用して設定した値のみが追加されます。その製品に既に存在する eVar を追加する場合は注意が必要です。
アドビでは、最も一般的に使用されるプラグインを使用できる拡張機能を提供しています。
プラグイン拡張機能を使用しない場合は、カスタムコードエディターを使用できます。
Analytics トラッキングオブジェクトをインスタンス化(s_gi
を使用)した後、AppMeasurement ファイルの任意の場所に次のコードをコピーして貼り付けます。実装時のコードのコメントとバージョン番号を記録しておくと、アドビが潜在的な問題のトラブルシューティングをおこなう際に役立ちます。
/******************************************* BEGIN CODE TO DEPLOY *******************************************/
/* Adobe Consulting Plugin: addProductEvar v1.0 */
s.addProductEvar=function(en,ev,ap){if("string"===typeof en&&"string"===typeof ev&&""!==ev)if(ap=ap||!1,this.products){var e=this.products.split(","),f=e.length;ap=ap?0:f-1;for(var a;ap<f;ap++)a=e[ap].split(";"),a[5]&&-1<a[5].toLowerCase().indexOf("evar")?a[5]=a[5]+"|"+en+"="+ev:a[5]?a[5]=en+"="+ev:a[5]||(a[4]||(a[4]=""),a[3]||(a[3]=""),a[2]||(a[2]=""),a[1]||(a[1]=""),a[5]=en+"="+ev),e[ap]=a.join(";");this.products=e.join(",")}else this.products=";;;;;"+en+"="+ev};
/******************************************** END CODE TO DEPLOY ********************************************/
addProductEvar
プラグインは次の引数を使用します。
en
(必須、文字列):現在 products 変数に含まれている最後のエントリに追加する eVar。products 変数が空白の場合、プラグインは「空白の」製品エントリを作成し、そのエントリの末尾に eVar 値を付加します。ev
(必須、文字列):eVar に割り当てられた値。ap
(オプション、ブール値):現在、products 変数に複数の製品エントリが含まれている場合、値が true(または 1)の場合、すべての製品エントリに eVar が追加されます。デフォルトは false(または 0)で、eVar が products 変数に含まれる最後のエントリのみに追加されます。addProductEvar
プラグインは何も返しません。代わりに、en
と ev
引数で指定された eVar(および eVar 値)を products
変数に追加します。
// Set a merchandising eVar to blue on the last product. The output for the products variable is ";product1;3;300,;product2;2;122,;product3;1;25;;eVar1=blue"
s.products=";product1;3;300,;product2;2;122,;product3;1;25";
s.addProductEvar("eVar1", "blue");
// Set a merchandising eVar to blue on all products. The output for the products variable is ";product1;3;300;;eVar1=blue,;product2;2;122;;eVar1=blue,;product3;1;25;;eVar1=blue"
s.products=";product1;3;300,;product2;2;122,;product3;1;25";
s.addProductEvar("eVar1", "blue", true);
// Set multiple merchandising eVars to the last product in the string. The output for the products variable is ";product1;3;300;event2=10;eVar23=large|eVar24=men|eVar1=blue,;product2;2;122,;product3;1;25;;eVar23=medium|eVar24=women|eVar1=red"
s.products=";product1;3;300;event2=10;eVar23=large|eVar24=men|eVar1=blue,;product2;2;122,;product3;1;25";
s.addProductEvar("eVar23", "medium");
s.addProductEvar("eVar24", "women");
s.addProductEvar("eVar1", "red");
// Set multiple merchandising eVars to all products in the string. The output for the products variable is ";product1;3;300;event2=10;eVar23=large|eVar24=men|eVar1=blue|eVar23=medium|eVar24=women|eVar1=red,;product2;2;122;;eVar23=medium|eVar24=women|eVar1=red,;product3;1;25;;eVar23=medium|eVar24=women|eVar1=red"
s.products=";product1;3;300;event2=10;eVar23=large|eVar24=men|eVar1=blue,;product2;2;122,;product3;1;25";
s.addProductEvar("eVar23", "medium", true);
s.addProductEvar("eVar24", "women", true);
s.addProductEvar("eVar1", "red", true);
// If the products variable is not set, the plug-in creates an empty product string correctly delimited to the merchandising eVar. The output for the products variable is ";;;;;eVar1=blue"
s.addProductEvar("eVar1", "blue");