Forum Replies Created

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • in reply to: Set default value for specific fields #36722
    vsexmogushiy
    Participant

    I double-checked the code and understand that the check does not work (for the previous link, the Screen size and another field that indicates the sending region) in the construction of such:

     if (!$('.quform-field-11_24').val()) {
        $('.quform-field-11_24').val('no');
    }
     

    I beg you, tell me how to fix it?

    • This reply was modified 1 year, 1 month ago by vsexmogushiy.
    in reply to: Set default value for specific fields #36716
    vsexmogushiy
    Participant

    Hi please tell me this code are correctly:

    
    //Размеры экрана
    jQuery(function ($) {
        $('.quform-field-1_32').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-2_35').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-5_36').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-6_38').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-7_39').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-8_40').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-9_36').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-10_39').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-11_39').val(
            window.screen.width + ' x ' + window.screen.height
        );
    
        $('.quform-field-12_40').val(
            window.screen.width + ' x ' + window.screen.height
        );
        
    });
    
    //Client ID
    jQuery(function ($) {
    	ym(93307677, 'getClientID', function(clientID) {
    		$('.quform-field-6_39, .quform-field-2_37, .quform-field-5_38, .quform-field-12_44, .quform-field-9_39, .quform-field-1_34, .quform-field-7_42, .quform-field-8_42, .quform-field-10_42, .quform-field-11_42').val(
    			clientID
    		);
    	});
    });
    
    //Yclid Gclid Ga UTM Ссылка  
    jQuery(function ($) {
        function setCookie(name, value, days){
            var date = new Date();
            date.setTime(date.getTime() + (days*24*60*60*1000));
            var expires = "; expires=" + date.toGMTString();
            document.cookie = name + "=" + value + expires + ";path=/";
        }
    
        function readCookie(name) {
            var n = name + "=";
            var cookie = document.cookie.split(';');
            for(var i=0;i < cookie.length;i++) {
                var c = cookie[i];
                while (c.charAt(0)==' '){c = c.substring(1,c.length);}
                if (c.indexOf(n) == 0){return c.substring(n.length,c.length);}
            }
            return 'no';
        }
    
        function getParam(p){
            var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
            return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
        }
    
        var yclid = getParam('yclid');
    
        if (yclid) {
            setCookie('yclid', yclid, 90);
        }
    
        var gclid = getParam('gclid');
    
        if (gclid) {
            setCookie('gclid', gclid, 90);
        }
    
        var utm_source = getParam('utm_source');
    
        if (utm_source) {
            setCookie('utm_source', utm_source, 90);
        }
    
        var utm_medium = getParam('utm_medium');
    
        if (utm_medium) {
            setCookie('utm_medium', utm_medium, 90);
        }
    
        var utm_campaign = getParam('utm_campaign');
    
        if (utm_campaign) {
            setCookie('utm_campaign', utm_campaign, 90);
        }
    
        var utm_content = getParam('utm_content');
    
        if (utm_content) {
            setCookie('utm_content', utm_content, 90);
        }
    
        var utm_term = getParam('utm_term');
    
        if (utm_content) {
            setCookie('utm_term', utm_term, 90);
        }
    
        $('.quform-field-6_43, .quform-field-2_39, .quform-field-5_40, .quform-field-12_46, .quform-field-9_41, .quform-field-1_36, .quform-field-7_44, .quform-field-8_44, .quform-field-10_44, .quform-field-11_44').val(readCookie('yclid'));
        $('.quform-field-6_47, .quform-field-2_40, .quform-field-5_41, .quform-field-12_47, .quform-field-9_42, .quform-field-1_37, .quform-field-7_45, .quform-field-8_45, .quform-field-10_45, .quform-field-11_45').val(readCookie('gclid'));
        $('.quform-field-6_56, .quform-field-2_41, .quform-field-5_42, .quform-field-12_48, .quform-field-9_43, .quform-field-1_38, .quform-field-7_46, .quform-field-8_46, .quform-field-10_46, .quform-field-11_46').val(readCookie('_ga'));
        $('.quform-field-6_51, .quform-field-2_42, .quform-field-5_43, .quform-field-12_49, .quform-field-9_44, .quform-field-1_39, .quform-field-7_47, .quform-field-8_47, .quform-field-10_47, .quform-field-11_47').val(readCookie('utm_source'));
        $('.quform-field-6_52, .quform-field-2_43, .quform-field-5_44, .quform-field-12_50, .quform-field-9_45, .quform-field-1_40, .quform-field-7_48, .quform-field-8_48, .quform-field-10_48, .quform-field-11_48').val(readCookie('utm_medium'));
        $('.quform-field-6_55, .quform-field-2_44, .quform-field-5_45, .quform-field-12_51, .quform-field-9_46, .quform-field-1_41, .quform-field-7_49, .quform-field-8_49, .quform-field-10_49, .quform-field-11_49').val(readCookie('utm_campaign'));
        $('.quform-field-6_54, .quform-field-2_45, .quform-field-5_46, .quform-field-12_52, .quform-field-9_47, .quform-field-1_42, .quform-field-7_50, .quform-field-8_50, .quform-field-10_50, .quform-field-11_50').val(readCookie('utm_content'));
        $('.quform-field-6_53, .quform-field-2_46, .quform-field-5_47, .quform-field-12_53, .quform-field-9_48, .quform-field-1_43, .quform-field-7_51, .quform-field-8_51, .quform-field-10_51, .quform-field-11_51').val(readCookie('utm_term'));
    
    });
    
    //Если пустое значение в размере экрана возвращать no
    if (!$('.quform-field-1_32').val()) {
        $('.quform-field-1_32').val('no');
    }
    
    if (!$('.quform-field-2_35').val()) {
        $('.quform-field-2_35').val('no');
    }
    
    if (!$('.quform-field-5_36').val()) {
        $('.quform-field-5_36').val('no');
    }
    
    if (!$('.quform-field-6_38').val()) {
        $('.quform-field-6_38').val('no');
    }
    
    if (!$('.quform-field-7_39').val()) {
        $('.quform-field-7_39').val('no');
    }
    
    if (!$('.quform-field-8_40').val()) {
        $('.quform-field-8_40').val('no');
    }
    
    if (!$('.quform-field-9_36').val()) {
        $('.quform-field-9_36').val('no');
    }
    
    if (!$('.quform-field-10_39').val()) {
        $('.quform-field-10_39').val('no');
    }
    
    if (!$('.quform-field-11_39').val()) {
        $('.quform-field-11_39').val('no');
    }
    
    if (!$('.quform-field-12_40').val()) {
        $('.quform-field-12_40').val('no');
    }
    
    //Если пустое значение в городе по dadata возвращать no
    if (!$('.quform-field-1_25').val()) {
        $('.quform-field-1_25').val('no');
    }
    
    if (!$('.quform-field-2_20').val()) {
        $('.quform-field-2_20').val('no');
    }
    
    if (!$('.quform-field-5_20').val()) {
        $('.quform-field-5_20').val('no');
    }
    
    if (!$('.quform-field-6_20').val()) {
        $('.quform-field-6_20').val('no');
    }
    
    if (!$('.quform-field-7_20').val()) {
        $('.quform-field-7_20').val('no');
    }
    
    if (!$('.quform-field-8_20').val()) {
        $('.quform-field-8_20').val('no');
    }
    
    if (!$('.quform-field-9_20').val()) {
        $('.quform-field-9_20').val('no');
    }
    
    if (!$('.quform-field-10_20').val()) {
        $('.quform-field-10_20').val('no');
    }
    
    if (!$('.quform-field-11_20').val()) {
        $('.quform-field-11_20').val('no');
    }
    
    if (!$('.quform-field-12_20').val()) {
        $('.quform-field-12_20').val('no');
    }
    
    //Если пустое значение в Предшесвующей ссылке возвращать no
    if (!$('.quform-field-1_30').val()) {
        $('.quform-field-1_30').val('no');
    }
    
    if (!$('.quform-field-2_24').val()) {
        $('.quform-field-2_24').val('no');
    }
    
    if (!$('.quform-field-5_24').val()) {
        $('.quform-field-5_24').val('no');
    }
    
    if (!$('.quform-field-6_36').val()) {
        $('.quform-field-6_36').val('no');
    }
    
    if (!$('.quform-field-7_24').val()) {
        $('.quform-field-7_24').val('no');
    }
    
    if (!$('.quform-field-8_24').val()) {
        $('.quform-field-8_24').val('no');
    }
    
    if (!$('.quform-field-9_24').val()) {
        $('.quform-field-9_24').val('no');
    }
    
    if (!$('.quform-field-10_24').val()) {
        $('.quform-field-10_24').val('no');
    }
    
    if (!$('.quform-field-11_24').val()) {
        $('.quform-field-11_24').val('no');
    }
    
    if (!$('.quform-field-12_24').val()) {
        $('.quform-field-12_24').val('no');
    }
    
    //Если пустое значение в ссылке после знака вопроса возвращать no
    if (window.location.search) {
        $('.quform-field-1_44').val(window.location.search);
    } 
    else {
        $('.quform-field-1_44').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-2_47').val(window.location.search);
    } 
    else {
        $('.quform-field-2_47').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-5_48').val(window.location.search);
    } 
    else {
        $('.quform-field-5_48').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-6_57').val(window.location.search);
    } 
    else {
        $('.quform-field-6_57').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-7_52').val(window.location.search);
    } 
    else {
        $('.quform-field-7_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-8_52').val(window.location.search);
    } 
    else {
        $('.quform-field-8_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-9_49').val(window.location.search);
    } 
    else {
        $('.quform-field-9_49').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-10_52').val(window.location.search);
    } 
    else {
        $('.quform-field-10_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-11_52').val(window.location.search);
    } 
    else {
        $('.quform-field-11_52').val('no');
    }
    
    if (window.location.search) {
        $('.quform-field-12_54').val(window.location.search);
    } 
    else {
        $('.quform-field-12_54').val('no');
    }
    
    • This reply was modified 1 year, 1 month ago by vsexmogushiy.
    • This reply was modified 1 year, 1 month ago by vsexmogushiy.
    • This reply was modified 1 year, 1 month ago by vsexmogushiy.
    • This reply was modified 1 year, 1 month ago by vsexmogushiy.
    • This reply was modified 1 year, 1 month ago by vsexmogushiy.
    in reply to: Set default value for specific fields #36715
    vsexmogushiy
    Participant

    The forms are located on different pages, then what is the principle of dividing them?

    in reply to: Set default value for specific fields #36712
    vsexmogushiy
    Participant

    Many thanks, but I see only “no” in some cases:

    1. For the screen size:

    jQuery(function ($) {
    $('.quform-field-1_32, .quform-field-2_35, .quform-field-5_36, .quform-field-6_38, .quform-field-7_39, .quform-field-8_40, .quform-field-9_36, .quform-field-10_39, .quform-field-11_39, .quform-field-12_40').val(
    window.screen.width + ' x ' + window.screen.height
    );
    });

    if (!$('.quform-field-1_32, .quform-field-2_35, .quform-field-5_36, .quform-field-6_38, .quform-field-7_39, .quform-field-8_40, .quform-field-9_36, .quform-field-10_39, .quform-field-11_39, .quform-field-12_40').val()) {
    $('.quform-field-1_32, .quform-field-2_35, .quform-field-5_36, .quform-field-6_38, .quform-field-7_39, .quform-field-8_40, .quform-field-9_36, .quform-field-10_39, .quform-field-11_39, .quform-field-12_40').val('no');
    }

    2. For the {referring_url}:


    if (!$('.quform-field-1_33, .quform-field-2_36').val()) {
    $('.quform-field-1_33, .quform-field-2_36').val('no');
    }

    • This reply was modified 1 year, 1 month ago by vsexmogushiy.
    in reply to: Set default value for specific fields #36629
    vsexmogushiy
    Participant

    Many Thanks, it works!

    However, please tell me how you can also send the default value (no) for the preceding link ({referring_url}) and for the data after the question mark (val(window.location.search))?

    in reply to: Set default value for specific fields #36623
    vsexmogushiy
    Participant

    In option 1, I set “no”,
    In option 2, I set {all_form_data|showEmptyFields:true}.

    However I see empty fields, without default value “no”. How I can fix it?

    Attachments:
    You must be logged in to view attached files.
    in reply to: Google Client ID #36606
    vsexmogushiy
    Participant

    Hello, once again, thank you very much and bow low. But here’s what I would like to know, how, if, for example, the same UTM tags are not on the page, to send the default value: no. This is the default value, but unfortunately in the form (if there are no values) They don’t come. And I would like to receive just the no value specified by default, please tell me how to do this.

    in reply to: Google Client ID #36595
    vsexmogushiy
    Participant

    Many Thanks, I try it.

    in reply to: Google Client ID #36560
    vsexmogushiy
    Participant

    Thank you very much, it seems to be working. We will check it out as soon as possible. And in order for everything to be set up correctly, maybe you can tell me how to correctly take the Google Client ID (that is, not gclid, but cid, which is what _ga calls in cookies).

    You can also specify in a separate hidden field what comes after the link sign with UTM or other parameters (that is, after the sign ?).

    • This reply was modified 1 year, 3 months ago by vsexmogushiy.
    in reply to: Google Client ID #36558
    vsexmogushiy
    Participant

    Thank you very much. It works.

    And one more thing. Tell please how I can add Yclid (step by step):

    STEP 1. Go to the Yandex Metrcia — https://yandex.ru/support/metrica/data/get-yclid.html?lang=en#null . Copy and insert example code every page:

    <script type="text/javascript">
    function setCookie(name, value, days){
    var date = new Date();
    date.setTime(date.getTime() + (days*24*60*60*1000));
    var expires = "; expires=" + date.toGMTString();
    document.cookie = name + "=" + value + expires + ";path=/";
    }
    function getParam(p){
    var match = RegExp('[?&]' + p + '=([^&]*)').exec(window.location.search);
    return match && decodeURIComponent(match[1].replace(/\+/g, ' '));
    }
    var yclid = getParam('yclid');
    if(yclid){
    setCookie('yclid', yclid, 90);
    }
    </script>

    STEP 2. GET Yclid.

    <form action="" name="myForm">
    Name: <input type="text" name="name">
    <!--Скрытое поле для извлечения yclid-->
    <input type="hidden" id="yclid_field" name="yclid_field" value="">
    <input type="submit" value="Submit Form" name="btnSubmit">
    </form>

    <!--Извлечение yclid и изменение скрытого поля-->
    <script>
    function readCookie(name) {
    var n = name + "=";
    var cookie = document.cookie.split(';');
    for(var i=0;i < cookie.length;i++) {
    var c = cookie[i];
    while (c.charAt(0)==' '){c = c.substring(1,c.length);}
    if (c.indexOf(n) == 0){return c.substring(n.length,c.length);}
    }
    return null;
    }
    window.onload = function() {
    document.getElementById('yclid_field').value =
    readCookie('yclid');
    }
    </script>

    How I can do this correctly?
    ——————————————————————

    And if you have the opportunity to tell me how to find out how to insert a Google Client ID into the form, as well as tell me how to set the UTM parameters (campaign, source, term and other) correctly in a separate field. I will be extremely grateful to you.

    in reply to: Google Client ID #36554
    vsexmogushiy
    Participant

    Unfortunately, I can’t transfer the data correctly (nothing works), so I ask you to look at the route and show me what the problem is.

    1. Go to the Yandex Metrcia — https://yandex.ru/support/metrica/objects/get-client-id.html?lang=en;

    Cope example code:
    ym(93307677, 'getClientID', function(clientID) {
      document.getElementById('clientID').value = clientID;
    });

    2. Add JS file with this code and connect my site (https://laptova.ru/scripts/clientid_userid_yclid.js).

    3. Add hidden fields in my forms with dynamic value, default value, without value. Add this code to Custom JavaScript:

    jQuery(function ($) {
        $('.quform-field-6_43, .quform-field-6_39. .quform-field-6_47').val(
            clientID()
        );
    });

    How I can send ClientID in my forms and how I can make it optimal?

    • This reply was modified 1 year, 3 months ago by vsexmogushiy.
    Attachments:
    You must be logged in to view attached files.
    in reply to: Google Client ID #36553
    vsexmogushiy
    Participant

    You are absolutely right about the hidden fields. That is, if I understood correctly, I just need to add the script specified by yours, where forms can open on the site.

    And in order for the necessary parameters from this script to work, get Google Client ID() and getYClientID(). Do I need to add custom JS to the section?

    in reply to: JS code after successful submission of a form #36372
    vsexmogushiy
    Participant

    Thank you very much, if I understand correctly, you also need to change:
    replaceVariables('{ip}')
    to:
    replaceVariables('{uniqid}')
    for install unique ID?

    But what to do for a dynamic value? More detailed settings are in the screenshot.

    • This reply was modified 1 year, 6 months ago by vsexmogushiy. Reason: code
    Attachments:
    You must be logged in to view attached files.
    in reply to: JS code after successful submission of a form #36366
    vsexmogushiy
    Participant

    The forms are located on all pages of the site (header, footer, body several times). If it is possible to make a JS code, this is bad news, PHP, as I understand it, will load a lot. Therefore, yes, of course we need at least some kind of option, the most productive and optimal.

    in reply to: JS code after successful submission of a form #36354
    vsexmogushiy
    Participant

    Thanks a lot for the answer, but the problem just occurred when caching was enabled. The Hyper X plugin is used, and the problem is that when sending invisible fields, they are cached (ip address, time of sending, user agent, and others). Invisible fields get into the cache and remain there, however, in the CMS, the data in the additional information block is filled in correctly. In more detail in the screenshots, tell me how to make invisible fields not fall into the cache?

    Attachments:
    You must be logged in to view attached files.
Viewing 15 posts - 1 through 15 (of 19 total)
Be inspired. © 2025 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy