• Resolved akupikree

    (@akupikree)


    Hi,

    I need to know about how to set the cookies when people submit the form, the popup will never appears again.

    1) Where should i place the code?

    After reading your doc “Using Triggers and Cookies Together” , i wanna use the Custom CSS and JS plugin. I know there is 3 ways of doing it. and this is one of them. Is this correct?

    Also, within the plugin, there are options to select and i dont know which one to use. ??

    Linking type
    -External File
    -Internal

    Where on page
    -Header
    -Footer

    Where in site
    -In Frontend
    -In Admin

    2) Another question is which code to use?

    I have followed the steps in your doc, but i need to know if the code im using is correct. What is in my mind is this (my form is popmake-132 and my cookie name is pum-132:

    jQuery('#popmake-132 form').on('submit', function () {
        var $this = jQuery('#popmake-132'),
            settings = $this.data('popmake'),
            auto_open = settings.meta.auto_open,
            cookie_name = "popmake-auto-open-" + settings.id;
    
        if (auto_open !== undefined && auto_open.enabled && auto_open.cookie_key !== undefined && auto_open.cookie_key !== '') {
            cookie_name = cookie_name + "-" + auto_open.cookie_key;
        }
    
        jQuery.pm_cookie(
            pum-132, // The cookie name that is checked prior to auto opening.
            true, // Setting a cookie value of true.
            '10 years', // Plain english time frame.
            '/' // Cookie path of / means site wide.
        );
    });

    Could you please tell me if this is so wrong. im not very good at coding and i really need your help.

    Thank you! appreciate your help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • @akupikree

    For the plug-in, these settings should get you by:

    Linking type
    -Internal

    Where on page
    -Footer

    Where in site
    -In Frontend

    As far as the code, as long as you’re using the Auto Open / Time Delay Trigger, then that should work for you. If you’re using a different trigger, this doc is where you should look. Add that code the same way you did here.

    No matter which method you use, make sure that you have your Manual JavaScript cookie added from the Popup Editor as well.

    Hope this helps!

    Thread Starter akupikree

    (@akupikree)

    Hi, thank you for your response. Appreciate it.

    I still couldn’t get the cookies to be set based on form submission. I believe there is something not right when calling the function.

    jQuery('#popmake-132 form').on('submit', function () {

    what name should i put in for “#popmake-132 form” ? im using mailpoet form. Will it be any difference? I can see from my “all popup list” dahsboard there is CSS classes column and it showing two names 1. popmake-132 | 2. popmake-newsletters. are these names meaning something in my codes?

    Thank you in advances! ??

    Plugin Author Daniel Iser

    (@danieliser)

    @akupikree – Try something like this.

    jQuery('#popmake-132 form').on('submit', function () {
        jQuery.pm_cookie(
            'pum-132', // The cookie name that is checked prior to auto opening.
            true, // Setting a cookie value of true.
            '10 years', // Plain english time frame.
            '/' // Cookie path of / means sitewide.
        );
    });

    Make sure that the first line matches your popup ID and the ‘pum-132’ line to match your cookie name in the popup editor.

    Hope that helps.

    Thread Starter akupikree

    (@akupikree)

    thank you @danieliser !!

    i removed the word “form” and only put my popup ID in the first line.

    Thank you so much. ??

    Plugin Author Daniel Iser

    (@danieliser)

    @akupikree – Did you get it working.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Where to add the JS code and which code to use?’ is closed to new replies.