Uncaught Reference Error: $ не определено - PullRequest
0 голосов
/ 12 декабря 2018

Я пытаюсь установить некоторые файлы cookie в своем магазине, чтобы иметь возможность отправлять правильную информацию на партнерскую платформу Admitad.У нас есть этот код для этого:

<script type="text/javascript">
// name of the cookie that stores the source
// change if you have another name
var cookie_name = 'deduplication_cookie';
// cookie lifetime
var days_to_store = 90;
// expected deduplication_cookie value for Admitad
var deduplication_cookie_value = 'admitad';
// name of GET parameter for deduplication
// change if you have another name
var channel_name = 'deduplication_channel';
// a function to get the source from the GET parameter
getSourceParamFromUri = function () {
var pattern = channel_name + '=([^&]+)';
var re = new RegExp(pattern);
return (re.exec(document.location.search) || [])[1] || '';
};
// a function to get the source from the cookie named cookie_name
getSourceCookie = function () {
var matches = document.cookie.match(new RegExp(
 "(?:^|; )" + cookie_name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + 
"=([^;]*)" 
));
return matches ? decodeURIComponent(matches[1]) : undefined;
};
// a function to set the source in the cookie named cookie_name
setSourceCookie = function () {
 var param = getSourceParamFromUri();
 if (!param) { return; }
 var period = days_to_store * 60 * 60 * 24 * 1000; // in seconds
 var expiresDate = new Date((period) + +new Date);
 var cookieString = cookie_name + '=' + param + '; path=/; expires=' + 
expiresDate.toGMTString();
document.cookie = cookieString;
document.cookie = cookieString + '; domain=.' + location.host;
};
// set cookie
setSourceCookie();
// define a channel for Admitad
if (!getSourceCookie(cookie_name)) {
  ADMITAD.Invoice.broker = 'na';
} else if (getSourceCookie(cookie_name) != deduplication_cookie_value) {
  ADMITAD.Invoice.broker = getSourceCookie(cookie_name);
} else {
  ADMITAD.Invoice.broker = 'adm';
}
</script>

И я получаю эту ошибку: Uncaught Reference Error: ADMITAD не определен Как мне определить переменную ADMITAD и где?Надеюсь, кто-то может помочь мне решить это.Большое спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...