タグ設定で下記記述を追記することで、指定のパラメータを次のページに引き継がれないように設定することが可能です。
設置手順
1. Version編集画面右手のツールバー>「タグ設定」をクリック
2. Javasript Head欄に下記記述をペーストする
<script>
class sbParams {
constructor() {
}
removeParameterToLink(list, type = 'black', selector = 'a[href^=http') {
const nodelist = document.body.querySelectorAll(selector);
const node = Array.prototype.slice.call(nodelist, 0);
node.forEach((element) => {
if (element.href.includes('tel:')) return
const href = new URL(element.href);
[...href.searchParams.keys()].forEach((name) => {
if ((type == 'black' && list.includes(name)) ||
(type == 'white' && !list.includes(name))) {
href.searchParams.delete(name);
}
})
element.href = href.toString();
});
}
}
</script>
3. Javasript Body欄に下記記述をペーストする
<script>
window.addEventListener('load', () => {
const SB = new sbParams();
SB.removeParameterToLink([
'⚪︎⚪︎⚪︎⚪︎',
'▲▲▲▲'
], 'black');
}, false);
</script>
4. 「⚪︎⚪︎⚪︎⚪︎」「 ▲▲▲▲」の部分に、引き継がれないようにしたいパラメータ名を入力してください。
例:「utm_parameter=abc」と「utm_creative=123」を引き継がれないようにしたい場合
<script>
window.addEventListener('load', () => {
const SB = new sbParams();
SB.removeParameterToLink([
'utm_parameter',
'utm_creative'
], 'black');
}, false);
</script>
- 除外したいパラメーターが1つのみの場合
- 「 ,'▲▲▲▲' 」を削除してください。
- 除外したいパラメーターが3つ以上の場合
- 各パラメータ名をクオーテーション(' ')で囲み、カンマで繋いで追加してください。