无需插件,无广告,为Shopify /WordPress独立站添加包裹追踪功能
我们在做独立站商城的时候,网站添加包裹追踪功能是一件较为重要的事情,主要体现在以下几个方面:
- 包裹追踪页面能够让用户实时了解包裹的运输状态,当前位置和预计到达时间,提升用户体验。
- 自助式查询不仅可以减轻客服的压力,还能让客户的问题得到及时的解决,提升效率。
除了安装使用一些插件外,我们也可以调用一些追踪网站的接口功能,非常简单,几分钟就可以搞定。跟着下面的视频学习吧!
视频教程
相关代码
Track123代码
<script type=”text/javascript”>window.track123WidgetConfig = {“api_base”:”https://www.track123.com”,”provider_type”:”1″,”language”:”en_US”,”theme_color”:”#03F907″,”width_type”:”auto”,”width_value”:””};(function (e, t, n) {var r, i = e.getElementsByTagName(t)[0];if (e.getElementById(n)) return;r = e.createElement(t);r.src = “https://www.track123.com/track123-widget.min.js”;i.parentNode.insertBefore(r, i)})(document, “script”, “track123-tracking-widget”)</script>
<div id=”track123-tracking-widget”></div>
17Track代码
<div style=”margin-top: 10px; margin-bottom: 20px;”><!–Tracking number input box.–> <input class=”Form__Input” type=”text” placeholder=”Enter your Tracking number” id=”YQNum” maxlength=”50″ style=”width: 100%; height: 57px;”> <!–The button is used to call script method.–> <input class=”Button” style=”background: #000; border-radius: 0; width: 100%; height: 50px; margin-left: 0px; color: #fff;” type=”button” value=”TRACK” onclick=”doTrack()”> <!–Container to display the tracking result.–>
<div id=”YQContainer”></div>
<!–脚本代码可放于页面底部,等到页面最后执行。–> <script type=”text/javascript” src=”//www.17track.net/externalcall.js”></script> <script type=”text/javascript”>
function doTrack() {
var num = document.getElementById(“YQNum”).value;
if(num===””){
alert(“Enter your number.”);
return;
}
YQV5.trackSingle({
//Required, Specify the container ID of the carrier content.
YQ_ContainerId:”YQContainer”,
//Optional, specify tracking result height, max height 800px, default is 560px.
YQ_Height:560,
//Optional, select carrier, default to auto identify.
YQ_Fc:”0″,
//Optional, specify UI language, default language is automatically detected based on the browser settings.
YQ_Lang:”en”,
//Required, specify the number needed to be tracked.
YQ_Num:num
});
}
// ]]>
</script></div>
(转载分享需注明出处,违者必究。)