Questions tagged [cookies]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
33 views

Logging into CP doesn't set authentication cookie

Trying to debug an issue where in a dev environment logging into the cp it doesn't set the CP Authentication Cookie (the hash with the _identity) at the end of it. I believe this is the root cause of ...
1
vote
1answer
38 views

Craft 2 Commerce 1 cart session expiry

Is it possible to change the cookie timeout just for the cart? E.g. I'd like to clear abandoned carts after X hours and keep all the other sessions untouched (e.g. user sessions etc). Please advise ...
0
votes
0answers
18 views

How to access Google Tag Manager cookies in Craft/Twig?

I am trying to access a cookie that was set with Google Tag manager. Is there anyway I can access the value? I tried craft.request.getCookie(name) but Craft or Twig isn't recognizing the cookie. Is ...
2
votes
2answers
115 views

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

This question was already asked a few years ago, and the way of doing it was through a plugin. I was wondering if there is a way of doing it just using Craft and Twig. I set up a cookie using ...
1
vote
1answer
36 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
41 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
36 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
295 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
306 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
15 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
146 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
246 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
473 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
454 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
48 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
163 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
266 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
361 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
460 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
227 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
222 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
331 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
116 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
290 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
1k 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
663 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
413 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
1k 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
347 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
204 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
4answers
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
244 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 ...