クライアントは、ショップの成功ページのスニペットを介して、Google Adwords を通じて Magento ウェブショップのコンバージョン率を測定したいと考えています。ウェブショップは多言語対応で、言語ごとに URL が異なりますが、すべて 1 つの Magento インストールに基づいています。
言語や国ごとに、独自のコンバージョン測定と独自のコード スニペットを備えた別の AdWords キャンペーンがあります。
URL を介してユーザーを識別し、それに応じて正しいスニペットを挿入する必要があることはわかっていますが、これを行うにはどうすればよいですか? ジャバスクリプトかPHPか?誰かヒントをください。
私の最初の試み
<?php
$currentDomain = $_SERVER['HTTP_HOST']
if ('shop.domain1.com' == $currentDomain) {
include('domain1script.php');
} elseif ('shop.domain2.com' == $currentDomain) {
include('domain2script.php');
} elseif ('shop.domain3.com' == $currentDomain) {
include('domain3script.php');
} elseif ('shop.domain4.com' == $currentDomain) {
include('domain4script.php');
}
?>
domain1script.php の場合:
<script type="text/javascript">
"scriptstuff"
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
"noscriptstuff"
</noscript>