Parameter/cookie conditional challenge

The idea is Section 1 contains a form to register to see content. Section 2 contains the content. The form redirects back to the page with a parameter and a cookie set that hides Section 1 and shows the content they registered for in Section 2. (Using both parameter and cookie rules so they will definitely get the content even if they have all cookies blocked.) I’ve done parameter-based show/hide rules before without issue, but this is giving me trouble. And I’m not super familiar with the new cookie dc elements but I’m excited to try!

Section 1:
Should show if the user a) does not have a cookie b) does not have a parameter.
For cookies, I have tried -

  • {{dc:cookie:get name=“archive_access”}} is not yes
  • {{dc:cookie:get name=“archive_access”}} is blank

For parameters I have tried -

  • {{dc:url:param key=“wkpass”}} is blank
  • y not in {{dc:url:param key=“wkpass”}}
  • y is not {{dc:url:param key=“wkpass”}}
  • {{dc:url:param key=“wkpass”}} is not y

Section 2 should show if a) the user has a cookie b) user has a parameter that equals y.

This rule works:

  • {{dc:url:param key=“wkpass”}} is y

These rules do not work:

  • {{dc:cookie:get name=“archive_access”}} is yes
  • {{dc:cookie:get name=“archive_access”}} is not blank

So to summarize: Section 1 rules don’t work at all, Section 2 rule works for parameter but not for cookie.
I tested by visiting the page with and without the parameter set. And I manually set the cookie and refreshed, confirming it was still there each time. (testing by form submission was going to be phase 2 of testing.)

I can live without the cookie rule if they don’t work that way, but the parameter rule not hiding Section 1 is challenging. Is this just a syntax thing I goofed up? Cache issue? (I can disable cache for this page if that helps!) I’ll reply with access info in case this sounds buggy and not like standard user error. :slight_smile:

Hello @GL_creative,

Thank you for the inquiry.

The name of the cookie is “archiveAccess”, not “archive_access”. We updated the condition.

Warm regards.

Sorry for the confusion!

I tried manually testing by creating a cookie by hand in devtools (firefox) with both archiveAccess to match what I’d set up the form to create and then changed the conditional cookie name to archive_access for manual testing in case cookies couldn’t use the “archiveAccess” format. Neither cookie name worked with manual cookie creation testing, so I didn’t update the form customization. I have updated the form code to use the name “archive_access” now to keep that in line with the name pattern other cookies typically use.

Rather than get into a disagreement over this syntax, let me show you a test that did not work.

image
The conditional rule is set to show the section if cookie “archive_access” is not value = “yes” - Trying this test with only the cookie conditional set.
image
image
Firefox cookie log shows “archive_access” value = “yes”.


The section of the page that should be hidden by this rule displays.

Section 2 rule that is also not working with cookie reading:
image
Not pictured: the version that was just the cookie conditional. That also didn’t work.
image
Firefox cookie log shows “archive_access” value = “yes”.
Visiting the page with this cookie set does not hide section 1 or show section 2.

I put the parameter rules back in as an or condition as you can see above. Using the ?wkpass=y parameter on the page DOES work, cookies do not. (I think I had trouble yesterday because I set it as an and condition.)

Thank you for the info.

We updated the condition of the first section to check both version of the cookie.

Please make sure to purge the cache before testing.

We also updated the condition of the second section.

Does that work for you?
Firefox with the cookie set as shown above still doesn’t change for me. (note, I’m using firefox to test in, I have the admin open in a different browser to make sure my login state doesn’t mess with anything)

I just now tried creating both versions of the cookie just in case, and no go. Page still loads for me with Section 1 visible, Section 2 hidden.

Yes, it’s working correctly. This is what displays after filling in the form.

And this is the cookie info:

Please clear the cookie storage, purge the cache, then try it again.

I think it’s working after form submission because after form submission, it takes you to the “webinar-archive/?wkpass=y” version of the page. The cookie itself doesn’t trigger the rules.

Dumped all cookies and cache.

Filled out the form, got to the correct version of the page (shows video). The url includes wkpass.

Take wkpass out of the url and refresh. Display goes back to Section 1 visible, Section 2 hidden.

After filling out the form, it should stay in video view because of the cookie, right?

The video or the Section 2 displays on our end even without the wkpass parameter as long as the cookie archive_access or archiveAccess is present.

Yeah dumped my cookies and cache, filled out the form, confirmed that the cookie is in there.

image

But going to the page without the parameter always shows the form.

Are you using firefox or chrome? I’ve been using firefox to test so far. But I can also try chrome to see if it works there. This is starting to feel like either a firefox thing or a my computer thing.

Okay confirmed to be happening on chrome also.

New window, never visited before from this browser so no cache, confirm no cookies.
Fill out form.
Get video view.
Confirm cookie is present.
Take parameter out of URL.
Back to form view.

Thank you for the info.

Yesterday, we checked the site on Opera on Mac M1, and it worked as expected. We checked it again today on Firefox on Windows 10, and it is still working correctly. However, when we tested it on Opera and Chrome on Windows 10, the cookie is not being retrieved correctly. It’s also not working on Firefox and Chrome Mac.

Have you tried testing this without the plugins enabled, especially the cache and security plugins? Can we deactivate the plugins while testing?

We’ll forward the issue to our channel.

Thank you for your patience.

Since it’s proving to have unusual behavior, I made a fresh staging copy of the site just now. Appreciate the team looking into this!

Thank you for the update.

The /webinar-archive/ page in the staging site is not displaying correctly when we’re not logged in. Did you configure anything on the page? We temporarily disabled all plugins, but the page is still not rendering properly. Can you confirm this in your end?

It had to do with the Under Construction plugin. That was set as the display page and for some reason disabling the plugin without first turning that off and purging the cache made it display as the blank under construction view. So that’s cleared and all plugins except temp login are disabled again.

I just disabled Varnish at the server level and that should help prevent any more cache based issues. But I’ve found that sometimes reactivating Breeze, purging, then deactivating again can be helpful when doing this kind of testing.

You should be able to make a regular admin login from the temp account if you’d like to log in normally and disable the temp admin plugin as well just in case.

Thank you for the info.

We deactivated all plugins except for Gravity Forms, and with this setup, the cookie condition works as expected, even without the wkpass parameter. This means that one of the plugins, probably the cache or security plugin, is causing the issue.

As mentioned in the video tutorial below, cache plugins can cause erratic behavior with the cookie function.

https://youtu.be/5m7EtG4Dw9s?t=474

I see, based on how this played out, my guess is Varnish is the ultimate culprit for the mixed compatibility. Definitely appreciate you all taking the time to troubleshoot this with me. Now that I have an idea of why my tests were failing I can continue to test and adjust plugins from here.

For documentation feedback: I typically check the official written docs for guidance and updates rather than video, since I find video is harder to search, skim, bookmark, and cross-reference. I did see a video on the official docs page, but I disregarded it as a feature preview rather than a source of information like this. In the future I’ll try to check video for answers! It would actually be wonderful if video transcripts could be included in docs. It makes information like this more searchable, helps deaf users, and people who process written information better. I’ve had good results with downloading auto captions and cleaning them up to include as on page text; saves a lot of time on transcription.

Thanks again for the assist!

Yes, it’s possible that the Varnish cache is affecting cookie retrieval. You could try excluding the pages from the cache. We tried this previously, but it didn’t help. Just thought you might have better luck with the result.

Thank you for your patience.