Mais conteúdo relacionado
Semelhante a GoogleWebsiteOptimizerの使い方:非同期タグバージョン (20)
Mais de VOYAGE GROUP UIO strategies section (8)
GoogleWebsiteOptimizerの使い方:非同期タグバージョン
- 10. テンプレートに埋め込むタグ1
制御スクリプトと
制御スクリプトとトラッキングスクリプト
スクリプト
テストページのソースコードの開始 <head>タグの直後に次のスクリプトを貼り付けます。
<!-- Google Website Optimizer Control Script -->
<script>
function utmx_section(){}function utmx(){}
(function(){var k='YYYYYYYYYY',d=document,l=d.location,c=d.cookie;function f(n){
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return escape(c.substring(i+n.
length+1,j<0?c.length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
d.write('<sc'+'ript src="'+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
'" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
</script>
<!-- End of Google Website Optimizer Control Script --> Xの部分はアカウントによって変更されます。
<!-- Google Website Optimizer Tracking Script -->
<script type="text/javascript"> Yの部分はテストによって変更されます。
var _gaq = _gaq || [];
_gaq.push(['gwo._setAccount', 'UA-XXXXXXXX-XX']);
_gaq.push(['gwo._trackPageview', '/YYYYYYYYYY/test']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- End of Google Website Optimizer Tracking Script -->
- 11. テンプレートに埋め込むタグ2
コンバージョンスクリプト
コンバージョンページのソースコードの開始 <head>タグの直後に次のスクリプトを貼り付けます。
<!-- Google Website Optimizer Conversion Script -->
<script type="text/javascript"> Xの部分はアカウントによって変更されます。
var _gaq = _gaq || [];
_gaq.push(['gwo._setAccount', 'UA-XXXXXXXX-X']); Yの部分はテストによって変更されます。
function doGoal(that) {
try {
_gaq.push(['gwo._trackPageview', '/YYYYYYYYYY/goal']);
setTimeout('document.location = "' + that.href + '"', 100)
}
catch(err){}
}
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- End of Google Website Optimizer Conversion Script -->
クリックをゴールとするためにコンバージョンスクリプトを改修します。
→太字の部分を追加する
- 12. テストを実施する部分とタグ3
<script>から</noscript>でくくった部分を
Googleウェブサイトオプティマイザーが認識をし、
管理画面上でhtmlをいじれるようになります。
<script>utmx_section(“result")</script>
<div id=“result” >
</noscript>
例
result
注意点1
<script>から</noscript>でくくった部分の中に
<noscript>タグが入っていると動きません。
はずすか、それを避けて指定してください。
注意点2
動的なテンプレートの場合、Smartyのタグなどを
<script>から</noscript>でくくった部分の中に
入れないようにお願いします。