Сейчас в сети: 630
Советы и вопросы по использованию скриптов AdWords
Подсказки
star_border
Ответить

Не подменяется цена в объявлении

Студент ✭ ✭

Всем привет)

 

Подскажите, как правильно прописать нужные параметры в скрипт подмены цены. Беру его отсюда https://seoprofy.ua/blog/kontekstnaya-reklama/skript-dlya-obnovlenie-ceny-adwords

Сайт http://cityplaza.lexus.ua/modelnyy-ryad/gs/komplektaciyi/gs-200t

Как в данном случае будет корректно прописать строки:

var PRICE_TEXT_BEGIN = 
var PRICE_TEXT_END =

Сейчас прописываю </td><td class="row_2 col_1" в начало, а что в конце - непонятно.

 

 

Спасибо за помощь.

Не подменяется цена в объявлении

Аспирант ✭

var PRICE_TEXT_BEGIN = '<td class="row_2 col_1"';

var PRICE_TEXT_END = '</td>';

Не подменяется цена в объявлении

Студент ✭ ✭

Не хочет Печальный Выдает 34 ошибки.

 

Все такого рода:

{1}: -//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="uk" version="XHTML+RDFa 1.0" dir="ltr"> <head profile="http://www.w3.org/1999/xhtml/vocab"> <!-- Google Tag Manager --> <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','GTM-MNM7KR');</script> <!-- End Google Tag Manager --> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="http://cityplaza.lexus.ua/sites/default/files/minnelli_logo_0.gif" type="image/gif" /> <meta name="description" content="LEXUS GS" /> <meta name="generator" content="Drupal 7 (http://drupal.org)" /> <link rel="canonical" href="http://cityplaza.lexus.ua/modelnyy-ryad/gs/model-gs" /> <link rel="shortlink" href="http://cityplaza.lexus.ua/taxonomy/term/197" /> <title>Модель GS | Лексус Сіті Плаза, Київ, Україна</title> <link type="text/css" rel="stylesheet" href="http://cityplaza.lexus.ua/sites/default/files/css/css_xE-rWrJf-fncB6ztZfd2huxqgxu4WO-qwma6Xer30m4.cs..." media="all" /> <link type="text/css" rel="stylesheet" href="http://cityplaza.lexus.ua/sites/default/files/css/css_6EVMiG-b4JtcVQa6CbKWHCf6AHry7uRke6VD01y80tI.cs..." media="all" /> <link type="text/css" rel="stylesheet" href="http://cityplaza.lexus.ua/sites/default/files/css/css_hcW0PQKPMk6rwn2re4SbMASFseRV41NPaOAen_8E4PE.cs..." media="all" /> <link type="text/css" rel="stylesheet" href="http://cityplaza.lexus.ua/sites/default/files/css/css_pXGHxgZlk9CByAmmcK-yYadqIEQmZnh4TehI6yiupLo.cs..." media="all" /> <link type="text/css" rel="stylesheet" href="http://cityplaza.lexus.ua/sites/default/files/css/css_rQBTb2_wQuAtlN4ik8DnRxBJjQ54EL9_nkEhZHJjmT0.cs..." media="all" /> <link type="text/css" rel="stylesheet" href="http://cityplaza.lexus.ua/sites/default/files/css/css_2THG1eGiBIizsWFeexsNe1iDifJ00QRS9uSd03rY9co.cs..." media="print" /> <link type="text/css" rel="stylesheet" href="http://cityplaza.lexus.ua/sites/default/files/css/css_G_p25bMBHujZYrAe7OKKO7nljyGUiETYZUWA6wbVbGQ.cs..." media="all" /> <script type="text/javascript" src="//code.jquery.com/jquery-1.10.2.min.js"></script> <script type="text/javascript"> <!--//--><![CDATA[//><!-- window.jQuery || document.write("<script src='/sites/all/modules/jquery_update/replace/jquery/1.10/jquery.min.js'>\x3C/script>") //--><!]]> </script> <script type="text/javascript" src="http://cityplaza.lexus.ua/misc/jquery.once.js?v=1.2"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/misc/drupal.js?oq3rnz"></script> <script type="text/javascript" src="//code.jquery.com/ui/1.10.2/jquery-ui.min.js"></script> <script type="text/javascript"> <!--//--><![CDATA[//><!-- window.jQuery.ui || document.write("<script src='/sites/all/modules/jquery_update/replace/ui/ui/minified/jquery-ui.min.js'>\x3C/script>") //--><!]]> </script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/jquery_update/replace/ui/external/jquery.cookie.js?v=67f...> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/jquery_update/replace/misc/jquery.form.min.js?v=2.69"></...> <script type="text/javascript" src="http://cityplaza.lexus.ua/misc/ajax.js?v=7.54"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/jquery_update/js/jquery_update.js?v=0.0.1"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/default/files/languages/uk_VxQN8guXvzRqnnM8c4mSgIVizbDwHZwDUTlp420NQ...> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/libraries/colorbox/jquery.colorbox-min.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/colorbox/js/colorbox.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/colorbox/styles/plain/colorbox_style.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/colorbox/js/colorbox_inline.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/iframe/iframe.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/misc/progress.js?v=7.54"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/ctools/js/modal.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/modal_forms/js/modal_forms_popup.js?oq3rnz"></script> <script type="text/javascript"> <!--//--><![CDATA[//><!-- jQuery(document).ready(function(){jQuery("#tabs").tabs();}); //--><!]]> </script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/libraries/jquery.cycle/jquery.cycle.all.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/libraries/jquery.imagesloaded/jquery.imagesloaded.js?oq3rnz"></s...> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/field_slideshow/field_slideshow.js?oq3rnz"></script> <script type="text/javascript" src="http://cityplaza.lexus.ua/sites/all/modules/autodialog/autodialog.js?oq3rnz"></script> <script type="text/javascript"> <!--//--><![CDATA[//><!-- jQuery.extend(Drupal.settings, {"basePath":"\/","pathPrefix":"","ajaxPageState":{"theme":"lexus","theme_token":"5dRNJH3trcwVp20OPXYL3ZukauTnohL7OJEiNXl-rXI","jquery_version":"1.10","js":{"sites\/all\/modules\/addthis\/addthis.js":1,"\/\/code.jquery.com\/jquery-1.10.2.min.js":1,"0":1,"misc\/jquery.once.js":1,"misc\/drupal.js":1,"\/\/code.jquery.com\/ui\/1.10.2\/jquery-ui.min.js":1,"1":1,"sites\/all\/modules\/jquery_update\/replace\/ui\/external\/jquery.cookie.js":1,"sites\/all\/modules\/jquery_update\/replace\/misc\/jquery.form.min.js":1,"misc\/ajax.js":1,"sites\/all\/modules\/jquery_update\/js\/jquery_update.js":1,"public:\/\/languages\/uk_VxQN8guXvzRqnnM8c4mSgIVizbDwHZwDUTlp420NQHE.js":1,"sites\/all\/libraries\/colorbox\/jquery.colorbox-min.js":1,"sites\/all\/modules\/colorbox\/js\/colorbox.js":1,"sites\/all\/modules\/colorbox\/styles\/plain\/colorbox_style.js":1,"sites\/all\/modules\/colorbox\/js\/colorbox_inline.js":1,"sites\/all\/modules\/iframe\/iframe.js":1,"misc\/progress.js":1,"sites\/all\/modules\/ctools\/js\/modal.js":1,"sites\/all\/modules\/modal_forms\/js\/modal_forms_popup.js":1,"2":1,"sites\/all\/libraries\/jquery.cycle\/jquery.cycle.all.js":1,"sites\/all\/libraries\/jquery.imagesloaded\/jquery.imagesloaded.js":1,"sites\/all\/modules\/field_slideshow\/field_slideshow.js":1,"sites\/all\/modules\/autodialog\/autodialog.js":1},"css":{"modules\/system\/system.base.css":1,"modules\/system\/system.menus.css":1,"modules\/system\/system.messages.css":1,"modules\/system\/system.theme.css":1,"misc\/ui\/jquery.ui.core.css":1,"misc\/ui\/jquery.ui.theme.css":1,"misc\/ui\/jquery.ui.tabs.css":1,"misc\/ui\/jquery.ui.button.css":1,"misc\/ui\/jquery.ui.resizable.css":1,"misc\/ui\/jquery.ui.dialog.css":1,"modules\/field\/theme\/field.css":1,"modules\/node\/node.css":1,"modules\/user\/user.css":1,"sites\/all\/modules\/wfm\/styles.css":1,"sites\/all\/modules\/views\/css\/views.css":1,"sites\/all\/modules\/ckeditor\/css\/ckeditor.css":1,"sites\/all\/modules\/colorbox\/styles\/plain\/colorbox_style.css":1,"sites\/all\/modules\/ctools\/css\/ctools.css":1,"sites\/all\/modules\/ctools\/css\/modal.css":1,"sites\/all\/modules\/modal_forms\/css\/modal_forms_popup.css":1,"sites\/all\/modules\/taxonomy_access\/taxonomy_access.css":1,"sites\/all\/modules\/field_slideshow\/field_slideshow.css":1,"sites\/all\/themes\/lexus\/css\/layout.css":1,"sites\/all\/themes\/lexus\/css\/style.css":1,"sites\/all\/themes\/lexus\/css\/colors.css":1,"sites\/all\/themes\/lexus\/css\/lexus.css":1,"sites\/all\/themes\/lexus\/css\/print.css":1,"public:\/\/css_injector\/css_injector_19.css":1,"public:\/\/css_injector\/css_injector_56.css":1}},"colorbox":{"opacity":"0.85","current":"{current} \u0437 {total}","previous":"\u00ab \u041f\u043e\u043f\u0435\u0440\u0435\u0434\u043d\u044f","next":"\u041d\u0430\u0441\u0442\u0443\u043f\u043d\u0430 \u00bb","close":"\u0417\u0430\u043a\u0440\u0438\u0442\u0438","maxWidth":"98%","maxHeight":"98%","fixed":true,"mobiledetect":true,"mobiledevicewidth":"480px"},"CToolsModal":{"loadingText":"\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f...","closeText":"\u0417\u0430\u043a\u0440\u0438\u0442\u0438 \u0432\u0456\u043a\u043d\u043e","closeImage":"\u003Cimg src=\u0022http:\/\/cityplaza.lexus.ua\/sites\/all\/modules\/ctools\/images\/icon-close-window.png\u0022 alt=\u0022\u0417\u0430\u043a\u0440\u0438\u0442\u0438 \u0432\u0456\u043a\u043d\u043e\u0022 title=\u0022\u0417\u0430\u043a\u0440\u0438\u0442\u0438 \u0432\u0456\u043a\u043d\u043e\u0022 \/\u003E","throbber":"\u003Cimg src=\u0022http:\/\/cityplaza.lexus.ua\/sites\/all\/modules\/ctools\/images\/throbber.gif\u0022 alt=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f\u0022 title=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f...\u0022 \/\u003E"},"modal-popup-small":{"modalSize":{"type":"fixed","width":300,"height":300},"modalOptions":{"opacity":0.85,"background":"#000"},"animation":"fadeIn","modalTheme":"ModalFormsPopup","throbber":"\u003Cimg src=\u0022http:\/\/cityplaza.lexus.ua\/sites\/all\/modules\/modal_forms\/images\/loading_animation.gif\u0022 alt=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f...\u0022 title=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f\u0022 \/\u003E","closeText":"\u0417\u0430\u043a\u0440\u0438\u0442\u0438"},"modal-popup-medium":{"modalSize":{"type":"fixed","width":550,"height":450},"modalOptions":{"opacity":0.85,"background":"#000"},"animation":"fadeIn","modalTheme":"ModalFormsPopup","throbber":"\u003Cimg src=\u0022http:\/\/cityplaza.lexus.ua\/sites\/all\/modules\/modal_forms\/images\/loading_animation.gif\u0022 alt=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f...\u0022 title=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f\u0022 \/\u003E","closeText":"\u0417\u0430\u043a\u0440\u0438\u0442\u0438"},"modal-popup-large":{"modalSize":{"type":"scale","width":0.8,"height":0.8},"modalOptions":{"opacity":0.85,"background":"#000"},"animation":"fadeIn","modalTheme":"ModalFormsPopup","throbber":"\u003Cimg src=\u0022http:\/\/cityplaza.lexus.ua\/sites\/all\/modules\/modal_forms\/images\/loading_animation.gif\u0022 alt=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f...\u0022 title=\u0022\u0417\u0430\u0432\u0430\u043d\u0442\u0430\u0436\u0435\u043d\u043d\u044f\u0022 \/\u003E","closeText":"\u0417\u0430\u043a\u0440\u0438\u0442\u0438"},"field_slideshow":{"field-slideshow-1":{"fx":"fade","speed":"1000","timeout":"4000","pause":0,"start_on_hover":0,"carousel_visible":"3","carousel_scroll":"1","carousel_speed":"500","carousel_vertical":0,"carousel_circular":0,"carousel_follow":0,"carousel_skin":"","pager":"","controls":[]}}}); //--><!]]> </script> </head> <body class="html not-front not-logged-in one-sidebar sidebar-first page-taxonomy page-taxonomy-term page-taxonomy-term- page-taxonomy-term-197" > <!-- Google Tag Manager (noscript) --> <noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-MNM7KR" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> <!-- End Google Tag Manager (noscript) --> <!-- AUDITORIUS PBP Smart Pixel V2.4 --> <script type="text/javascript"> (function (d) { var pxl = d.createElement("script"); pxl.setAttribute("src", (d.location.protocol === "https:" ? "https" : "http") + "://smartpixel.auditorius.ru/containers/488/smartPixel.min.js"); pxl.setAttribute("type", "text/javascript"); pxl.async = true; var s = d.getElementsByTagName("script")[0]; s.parentNode.insertBefore(pxl, s); }(document)); </script> <div id="skip-link"> <a href="#main-content" class="element-invisible element-focusable">Перейти до основного вмісту</a> </div> <div id="page-wrapper"><div id="page"> <div id="header" class="without-secondary-menu"><div class="section clearfix"> <div class="region region-header"> <div id="block-block-30" class="block block-block clearfix"> <div class="content"> <div class="w30"><a href="/" target="_self" title="Тойота Київ" style="font-size:20px"><img alt="Тойота Київ" src="/sites/default/files/minnelli_logo.gif" title="Тойота Київ"></a></div> <div class="w40"> <ul> <li style="font-size:20px; line-height: normal;"><a href="tel:380444994009"> Відділ продажу:<br> <span class="ringo-phone1" style="font-size:16px">(044) 499-40-09</span></a></li> <li style="font-size:20px; line-height: normal;"><a href="tel:380444958585"> Відділ cервісу:<br> <span class="ringo-phone2" style="font-size:16px">(044) 495-85-85</span></a></li> </ul> </div> <div class="w30"> <ul> <li><a href="http://cityplaza.lexus.ua/" target="_self" title="Тойота Київ"><img alt="Тойота Київ" src="/sites/default/files/lexus-kiev.png" style="height:20px; width:230px" title="Тойота Київ"></a><a href="/pro-salon">Київ, вул. Мечникова, 2а</a> БЦ «Парус»</li> </ul> </div> </div> </div> <div id="block-views-91f02e3fbb684286820acf501caf2ddb" class="block block-views"> <div class="content"> <div class="view view-lexus-view-menu-models-header view-id-lexus_view_menu_models_header view-display-id-block view-dom-id-86c2f1067171e9592fb462beffaefd09"> <div class="view-content"> <table class="views-view-grid cols-99"> <tbody> <tr class="row-1 row-first row-last"> <td class="col-1 col-first header-modellist"> <span class="views-field views-field-name"> <span class="field-content"><a href="/modelnyy-ryad/new">NEW IS</a></span> </span> <span class="views-field views-field-field-models-icon-for-menu"> <span class="field-content"><a href="/modelnyy-ryad/new"><img src="http://cityplaza.lexus.ua/sites/default/files/styles/icon-for-models-icon-64x41/public/is_0.png?itok..." width="64" height="41" alt="" /></a></span> </span>

Не подменяется цена в объявлении

Аспирант ✭

var PRICE_TEXT_BEGIN = '<td class=\"row_2 col_1\"';

var PRICE_TEXT_END = '</td><td class=\"row_2 col_2\">';

Не подменяется цена в объявлении

Студент ✭ ✭

Дмитрий, попробовала, как вы написали, снова ошибка:

Keyword: [keyword +lexus +gs], Price: 
Invalid argument: insertionText. Should be of type: non-empty string (line 19)

Страница, с которой должно подтягивать цену
http://cityplaza.lexus.ua/modelnyy-ryad/gs/komplektaciyi/gs-200t
Цена 1 400 709 грн.

Не подменяется цена в объявлении

Аспирант ✭

замените эту строку
prices[url] = htmlCode.substr(priceStart, priceEnd - priceStart).replace(/\D/, '');

 

На вот такую

prices[url] = parseInt(htmlCode.substr(priceStart, priceEnd - priceStart).replace(/\D/, '').replace(/\s/g,""),10);

Re: Не подменяется цена в объявлении

Аспирант ✭
var PRICE_TEXT_BEGIN = '<td class=\"row_2 col_1\"';
var PRICE_TEXT_END = '</td><td class=\"row_2 col_2\">';

function main() {
  var url = "http://cityplaza.lexus.ua/modelnyy-ryad/gs/komplektaciyi/gs-200t";
  var prices = {};
  var htmlCode;
  try {
    htmlCode = UrlFetchApp.fetch(url).getContentText();
  } catch(e) {
    Logger.log('There was an issue checking:'+url+', Skipping.'); 
  }
  var priceStart = htmlCode.indexOf(PRICE_TEXT_BEGIN) + PRICE_TEXT_BEGIN.length;
  if(priceStart >= 0) {
    var priceEnd = htmlCode.indexOf(PRICE_TEXT_END, priceStart);
    prices[url] = parseInt(htmlCode.substr(priceStart, priceEnd - priceStart).replace(/\D/, '').replace(/\s/g,""),10);
    Logger.log(typeof prices[url]);
    Logger.log(prices[url]);
  }
  
}

Тестовый скрипт

Не подменяется цена в объявлении

Студент ✭ ✭

Спасибо, разобралась.