2016-11-23 4 views
0

アウトバウンドクリックトラッキングのための正しい汎用GAを実装しましたが、オフサイトをクリックしたときに発生する「スピードバンプ」ポップアップメッセージの1つも実装しましたリンク、以下のjavascriptを使用します。 (銀行クライアント - スピードバンプが必要)GoogleアナリティクスのアウトバウンドクリックとJavascript「スピードバンプ」を組み合わせる

これは、GAアウトバウンドクリックトラッキングを何らかの形で「破る」でしょうか? (人物クリックすると、モーダルボックスは、免責事項をポップアップ表示し、「続行」または「辞退」ボタンの選択見ている。)私がそこに持って

$(document).ready(function() { 
$('.external').click(function() { 
var link = $(this).attr('href'); 

$('<div>By accessing this link you will be leaving the site...</div>').dialog({ 
    title: "Third-Party Site Disclaimer", 
    modal : true, 
    overlay: { 
    backgroundColor: '#fff', 
    opacity: 1 
    }, 
    buttons: { 
    'Continue': function() { 
     $(this).dialog('close').remove(); 
     window.open(link); 
    }, 
    'Decline': function() { 
     $(this).dialog('close').remove(); 
     return false; 
    } 
    } 
}); 

return false; 
}); 
}); 

Googleのアウトバウンドクリックトラッキングコード:

<script> 
    /** 
    * Function that tracks a click on an outbound link in Analytics. 
    * This function takes a valid URL string as an argument, and uses that URL string 
    * as the event label. Setting the transport method to 'beacon' lets the hit be sent 
    * using 'navigator.sendBeacon' in browser that support it. 
    */ 
    var trackOutboundLink = function(url) { 
     ga('send', 'event', 'outbound', 'click', url, { 
     'transport': 'beacon', 
     'hitCallback': function(){document.location = url;} 
     }); 
    } 
    </script> 
+0

あなた自身でテストしましたか? –

+0

アウトバウンドリンクトラッキングに使用した方法を教えてください。私の推測では、今は「去りたい」という意図だけを追跡しているということです...もっと明示的なユーザーアクションのために、このモーダルの「継続」と「拒否」機能の中にイベントを追加する必要があります。 – GreatBlakes

+0

上記のアウトバウンドクリックコードを追加しました。ありがとうございました - これは私を超えています。 –

答えて

0

知らずアウトバウンドリンクのトラッキングを設定する方法を説明します。ここでは、提供されたコードにGAイベントを配置します(カテゴリ、アクション、ラベルの名前付け方法など)。

$(document).ready(function() { 
    $('.external').click(function() { 
    var link = $(this).attr('href'); 
    ga('send', 'event', 'Outbound Link', 'Intent', link); 

    $('<div>By accessing this link you will be leaving the site...</div>').dialog({ 
     title: "Third-Party Site Disclaimer", 
     modal : true, 
     overlay: { 
     backgroundColor: '#fff', 
     opacity: 1 
     }, 
     buttons: { 
     'Continue': function() { 
      ga('send', 'event', 'Outbound Link', 'Disclaimer Continue', link); 
      $(this).dialog('close').remove(); 
      window.open(link); 
     }, 
     'Decline': function() { 
      ga('send', 'event', 'Outbound Link', 'Disclaimer Decline', link); 
      $(this).dialog('close').remove(); 
      return false; 
     } 
     } 
    }); 

    return false; 
    }); 
}); 

これで、アウトバウンドリンクのインテントをトラッキングしてから、別のアクションとして継続/拒否を追跡するようになりました。

+0

ありがとうございます - 私はGoogleからの送信トラッキングコードを追加しました。上記の回答はまだ機能していますか?私は非常に援助に感謝します。 –

+0

ありがとうございます。私はそのコードをテストしていますが、動作していると思います。助けを感謝します! –

関連する問題