[英]How to fix “This language feature is only supported for ECMASCRIPT6 mode” in GTM?
I try to use some js code in GTM, but have this error. 我尝试在GTM中使用一些js代码,但出现此错误。 an error occurs in this line
该行发生错误
window.sbHooks.addAction('sbCoreState::CreateBets/success', (data, response) => {
where i used custom vue js hook. 我在哪里使用自定义vue js钩子。 how i can fix it?
我该如何解决?
<script>
if (typeof window.sbHooks === 'object') {
// отправим данные о достижении цели (размещение ставки/прогноза) в Яндекс Метрику
window.sbHooks.addAction('sbCoreState::CreateBets/success', (data, response) => {
//data.express_bet - сумма экспресса, если это значение есть - то ставка экспресс
//data.express_tip - текст экспресса
//добавлен экспресс с прогнозом или без
if (
typeof data.express_bet !== 'undefined' &&
typeof response.body.ids !== 'undefined' &&
Array.isArray(response.body.ids) &&
response.body.ids.length > 0
) {
if (typeof yaCounter47035968 != 'undefined') {
yaCounter47035968.reachGoal('AddTipExpress');
if (data.express_tip.length > 0) {
yaCounter47035968.reachGoal('AddReviews');
}
}
}
// Если это несколько ставок, то переберем их и посмотрим есть ли текст
if (
typeof data.express_bet == 'undefined' &&
data.bets.length > 0
) {
for (var i = 0; i <= data.bets.length - 1; i++) {
var tip_text = data.bets[i].tip_text;
if (typeof yaCounter47035968 != 'undefined') {
yaCounter47035968.reachGoal('AddTipOrdinary');
if (typeof tip_text !== 'undefined') {
yaCounter47035968.reachGoal('AddReviews');
}
}
}
}
});
}
</script>
Convert the arrow function to a function
function. 将箭头函数转换为
function
函数。
window.sbHooks.addAction('sbCoreState::CreateBets/success', function(data, response) {
// the rest stays the same
您必须删除箭头,因此您的函数必须如下所示:
window.sbHooks.addAction('sbCoreState::CreateBets/success', function (data, response) {
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.