I'm creating custom HTML with GoogleTagManager, but I can't put a number string in the getTimeStamp. Also, GTM does not support ES6, so it is essential to write ES5.
<script>
function formatDate(dt) {
var y = ('00'+dt.getFullYear()).slice(-2);
var m = ('00' + (dt.getMonth()+1)).slice(-2);
var d = ('00' + dt.getDate()).slice(-2);
var h = ('00' + dt.getHours()).slice(-2);
var mm = ('00' + dt.getMinutes()).slice(-2);
return (y + m + d + h + mm);
}
nowDate = formatDate(new Date());
var getTimeStamp = nowDate;
if (!window.dtlpcvCvConf) {
window.dtlpcvCvConf = [];
}
window.dtlpcvCvConf.push({
siteId: "xxx",
commitData: {
pid: "xxxx",
amount: "",
mid: "",
u: getTimeStamp,
t:"xxx",
cvinfo:"xxx"
}
});
</script>
<script src="https://dep.tc/public/js/lpcv.js?cid=xxx&pid=xxx&t=xxx" async="async"></script>