Web 推送内容门控
门控内容通常是指将资源(例如白皮书、案例研究)置于表格或注册后面的过程,要求访问者在授予他们访问资源之前进行订阅。
借助 Aimtell,您可以轻松创建门控内容,以鼓励访问者订阅您的推送通知。本文将引导您完成实现这一目标的基本步骤。
第 1 步:定义隐藏内容
首先定义您希望向已授予权限的人和未授予权限的人显示哪些内容。下面是一个简单的示例,说明了如何构建它。
` 请务必订阅我们的通知以访问下面的精彩内容。 `
``步骤2:根据权限显示内容
接下来,您需要添加一些逻辑以根据当前权限显示内容。这是通过 aimtell javascript 完成的。
//定义已授予权限的人应该做什么function _aimtellPermissionGranted(){document.getElementById('eratedApprovedContent').style.display = 'block';document.getElementById('gateDeniedContent').style.display = 'none';}//定义没有授予权限的人应该做什么function _aimtellPermissionDenied(){document.getElementById('eratedDeniedContent').style.display = 'block';}//等待aimtell完全加载后再运行所有内容function _aimtellReady(){//如果他们已授予权限if(_aimtellCheckPermissions() == 'granted'){_aimtellPermissionGranted();}//如果他们没有授予权限(或拒绝)它)else{_aimtellPermissionDenied();}}
第 3 步:将所有内容放在一起
就是这样。您只需将它们添加到您的页面即可完成!因此,它在您的页面上看起来就像这样。
<!-- This content will always be visible -->
<div id='visibleContent'><p> Be sure to subscribe to our notifications to get access to our sweet content below. </p></div><!-- This content will only be visible if the visitor has approved permissions to your notifications -->
<div id='gatedApprovedContent' style='display:none'><p> Here's a link to our content!</p></div><!-- This content will only be visible if the visitor has denied permissions to your notifications -->
<div id='gatedDeniedContent' style='display:none'><p> Oh, boy! Looks like you've haven't granted permissions. You'll need to accept permissions if you want access...</p></div><script>
//define what should be done for those who have granted permissionfunction _aimtellPermissionGranted(){document.getElementById('gatedApprovedContent').style.display = 'block';
document.getElementById('gatedDeniedContent').style.display = 'none';
}//define what should be done for those who have not granted permissionfunction _aimtellPermissionDenied(){document.getElementById('gatedDeniedContent').style.display = 'block';
}//wait till aimtell is fully loaded before running everythingfunction _aimtellReady(){//if they have granted permissionsif(_aimtellCheckPermissions() == 'granted'){_aimtellPermissionGranted();
}//if they have not granted permissions (or denied it)else{_aimtellPermissionDenied();
}}
</script>