Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [cookies]

The tag has no usage guidance.

1
vote
1answer
35 views

Is there an alternative to the Dukt Rest plugin for Craft 3?

I am using a combination of two Craft 2 plugins, Cookies and Rest to get the logged in status of a user. What is the recommended way of doing this in Craft 3? {% set userReq = craft.rest.request ...
1
vote
1answer
27 views

How to add CSRF cookie directive?

I need to add the SameSite directive to my site's CSRF cookie, as explained in these mozilla security guidelines. According to the Craft docs, "Craft handles the cookie creation automatically." Is ...
1
vote
1answer
33 views

Craft Cookies Plugin: Font Loading Detection

I'm trying to re-write my font loading detection using the Craft Cookies Plugin. I'm unsure if what I have done is correct... Before <!--# if expr="$HTTP_COOKIE=/fonts\-loaded\=1/" --> <...
1
vote
1answer
200 views

How to set cookie to only show intro animation once per session

I'm a Craft beginner, so forgive me if this is an easy question. I have an intro animation, that I'd only like to show on the first visit to the site, so that it doesn't load again when the user ...
1
vote
1answer
240 views

Cookiebot finding TS# cookie

As part of the new GDPR requirements in europe I've used cookiebot to show visitors what cookies we use on our site. It's managed to show us what all but 1 cookie is used for. The cookie is called TS#...
0
votes
0answers
13 views

How to cache location per guest in craft cache via plugin

I am looking at setting the currency of a guest site visitor. I have the look up and currency retrieval working OK based on the individuals IP. The problem i seem to face is how to cache the currency ...
2
votes
1answer
98 views

Craft 3: Recognize cookies created in Craft 2

In Craft 2, we could set a cookie like this... craft()->userSession->saveCookie() ... and that would make it a state cookie. This thread describes it pretty well. Essentially, you would end up ...
2
votes
1answer
207 views

Craft 3: how can I auto-redirect to a site version using the user IP?

I have set up multi-sites using several locales: — International Website — English — Local Website — French — Dutch — etc. If the user has a French or Dutch IP, it should be auto-...
0
votes
1answer
430 views

Greetings - about cookies?

I'm not a web developer but I seem to have taken over our business website. It uses apnexus doubleclick and google analytics I need to make sure we are prepared for the GDPR and seek consent from ...
1
vote
2answers
339 views

Bypass Varnish cache if user is logged in

Is it possible to bypass the Varnish cache when the user is logged in? I've tried using the "CraftSessionId" cookie, but it seems that it is also set for non logged in users.
1
vote
0answers
45 views

Language Cookies Issues

Scenario 1: A language other than English is selected. New website.com visits will be in that language. Even after switching back to English, websites will continue to load in the previous language. ...
1
vote
1answer
133 views

Craft Commerce cart timing out but allowing order to be processed

We had a Stripe order go through recently, where the order value was zero and there were no line items. The client has called the customer to figure out what happened: The customer added a product to ...
2
votes
1answer
246 views

“An unknown error occurred.” appears when I try to log into Craft's admin using browsersync's proxy mode

I've stumbled upon a weird thing. When I run browsersync as browser-sync start -p localhost:8000 and try to log into Craft's admin at localhost:3000/admin I get the message "An unknown error occurred....
4
votes
1answer
339 views

How can I disable sessions for most of my Craft site?

We're running a craftcms-backed site that uses sessions only for the admin pages. For a few reasons, we'd like to disable session logic for all other urls: the Set-Cookie header that craft uses to ...
1
vote
1answer
412 views

Session cookies

I'm in the process of adding a second site to a Craft installation using custom locales. The two sites will be accessed on different sub-domains, e.g. site1.domain.com and site2.domain.com. I need to ...
1
vote
1answer
217 views

Why does the UserSessionService create a *state* cookie?

I'm trying to set a cookie using saveCookie(), and I'm puzzled by the UserSessionService's behaviour. Instead of creating a plain old cookie, Craft actually creates a so-called state cookie, where ...
1
vote
1answer
193 views

How can I delete a cookie from a plugin?

I am able to set a plain old cookie like this: $cookie = new HttpCookie('myCookie', 'myValue'); I am trying to delete it like this: $cookie = new HttpCookie('myCookie', ''); craft()->request->...
0
votes
1answer
279 views

Is it possible to extend the lifetime of the CraftSessionId cookie?

I would like to extend the lifetime of the CraftSessionId cookie. Is this possible and if so, where can I change the value? Thank you for your time.
1
vote
0answers
112 views

Add entry ids to a session cookie/variable array on button click?

I'm looking for a way to add entry ID's to an array in either a session cookie or a session variable. I've installed the LJ Cookies plugin (https://github.com/lewisjenkins/craft-lj-cookies) in the ...
1
vote
1answer
249 views

Setting cookies from CTA before directing to url?

I need to set some cookies based on some CTA button links. I will later be checking for these cookies to determine what content to display on the entry with the cta on the next visit and other entries ...
4
votes
3answers
981 views

Change page elements based on geolocation

We would like to geolocate visitor IP addresses, and for US-based addresses render a portion of the page to display state-specific options. I actually have the PHP working well to pull the 2-letter ...
1
vote
1answer
628 views

How should I set an arbitrary session value in a plugin?

I have some data I want to store in session: $data = array ( 'id' => '23539471' 'token' => 'cf310b81-9431-4303-804d-c1635ae29278' ); In my plugin I am doing this: new HttpCookie('...
1
vote
1answer
388 views

Automatically Log in User

In my Controller I created a script to add a user to the database, is there a way I can automatically: 1) Log them in and 2) Set a permanent session cookie or similar? I basically don't want the ...
1
vote
1answer
954 views

Unable to retrieve a cookie set by another application on the same domain

We have a Laravel app that sets a cookie: public function make($name, $value, $minutes = 0, $path = null, $domain = null, $secure = false, $httpOnly = true) { list($path, $domain) = $this->...
4
votes
2answers
2k views

Best way to use saveCookie and craft.request.getCookie('location')

Following up on this question: Prescribed way to set cookies (from plugin or Twig) the following works great. craft()->userSession->saveCookie($cookieName, $data, $duration); I can see ...
1
vote
1answer
318 views

Any way to turn cookies off for the front end?

Any way to turn cookies off for the front end? I think it's only CraftSessionId being set, but still, anyone know? Cheers,
4
votes
1answer
2k views

How can I get cookies that were set in javascript from a twig template?

The docs state that {{ craft.request.getCookie(name) }} will not work for cookies that were set in JavaScript, because all cookies in Craft go through some validation to ensure that they aren't ...
2
votes
2answers
200 views

Getting redirected to login page on every other CP request when using Vagrant

I'm developing on a Virtual Box on a Mac, and every time I log into the CP, I can log in successfully and click on one (maybe two) links before getting redirected to login again. I tested this on a ...
6
votes
3answers
5k views

Prescribed way to set cookies (from plugin or Twig)

From either a plugin or a Twig template, is there a prescribed way to set (and get) cookies? I've seen https://github.com/lewisjenkins/craft-lj-cookies/, which just uses PHP's setcookie. Also ...
4
votes
1answer
239 views

How is “craft()->fileCache” different from using cookies?

Just looking for a little clarification on the craft()->fileCache method... Everybody already knows that when a cookie is set, that cookie only exists on the end-user's computer. No one else using ...