Questions tagged [cookies]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
27 views

Cookies Change-If we add(/?) with URL content changes are reflected

We have done content changes in site(www.windstream.com)after changing content in this site and we clear cookies as well. But still changes are not reflected. If we add(/?) with URL content changes ...
balaji Viswanathan's user avatar
0 votes
0 answers
45 views

Complete Cookie Consent: The popup cannot be closed

We have installed plugin Complete Cookie Consent on a bilingual craft site. Now we have the problem that in the frontend the cookie message can not be closed: You click on the close button, but the ...
ChuckLean's user avatar
0 votes
0 answers
75 views

Feed me and Guzzle: Use session cookies

I am using Feed me to import data from a Filemaker server via a self made Craft module. The import works well. I fail however to import the image files from the Filemaker server: Feed me gets their ...
Moritz's user avatar
  • 69
0 votes
1 answer
764 views

Not instantiable – yii\di\NotInstantiableException when setting and reading cookies

Hello, within a craft template I query the existence of a cookie to visually highlight new entries in the CMS with CSS. This worked for a long time without any problems. A visitor told me that on ...
Andreas Ploch's user avatar
1 vote
1 answer
103 views

Can't access Cookie from controller in plugin

In the frontend my website sets a cookie wich i need during a controller action. When calling the controller action from my plugin this Cookie gets duplicated and the value is replaced with an ...
Mathies Gielen's user avatar
1 vote
0 answers
163 views

How to keep logged in User on 1 Craft Multi Site, but with different domains

I have one multisite craft installation, where the different languages for the sites use different domains: en -> domain.com de -> otherdomain.com .. Users can log in via frontend. Now if users ...
Henrik's user avatar
  • 425
2 votes
1 answer
30 views

Cookie-Plugin: Why does Cookies get closing by change entry via navigation / menu?

We want to solve a pop-up or a so-called "header info" about the cookie plugin "Cookies". We have assigned and created the cookie accordingly. It appears as soon as we set (initial ...
ChuckLean's user avatar
1 vote
1 answer
135 views

Show content since last visit

I would like to show new content to users since their last visit, and a bit confused about the best approach. I'm thinking I should use the Cookies plugin and something like this: {% if not ...
supazu's user avatar
  • 526
1 vote
1 answer
380 views

CRAFT_CSRF_TOKEN is failing to write

Seeing some odd behavior in Chrome where we can no longer log into our dev site, which is currently served over HTTP. But, if we try logging in using an incognito window, it works. It looks like the ...
Jegra's user avatar
  • 81
1 vote
1 answer
442 views

How to implement "cookie consent message" to visitors of our website using Craft 3

I want to implement cookie using message to the visitors of our site. How we will implement this in craft 3? A sample message is "Hi there, we use cookies to offer you a better browsing experience ...
Rakhi Vijayan's user avatar
1 vote
1 answer
294 views

Campaign UTM Tracking through to form

My client has asked that I track and send campaign information through a contact form. So basically a user might come to the site on this type of URL: domain.com/?utm_source=Facebook&utm_medium=...
Malcolm Maclean's user avatar
0 votes
0 answers
215 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 ...
zhua89's user avatar
  • 31
1 vote
1 answer
180 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 ...
biko's user avatar
  • 670
2 votes
2 answers
1k 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 ...
Jorge Sosa's user avatar
1 vote
1 answer
54 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 ...
Stephan Ango's user avatar
1 vote
1 answer
319 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 ...
Andrea Hall's user avatar
1 vote
1 answer
49 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/" --> <...
Dan Lee's user avatar
  • 1,107
1 vote
1 answer
558 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 ...
dave's user avatar
  • 13
1 vote
1 answer
530 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#...
Julian Fricker's user avatar
0 votes
0 answers
28 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 ...
joomkit's user avatar
  • 2,014
2 votes
1 answer
409 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 ...
Lindsey D's user avatar
  • 24k
2 votes
1 answer
470 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-...
Romain P.'s user avatar
  • 1,818
1 vote
1 answer
679 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 ...
Mister Furious's user avatar
1 vote
2 answers
1k 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.
Jose Manosalvas's user avatar
1 vote
0 answers
64 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. ...
FrankHJ's user avatar
  • 11
1 vote
1 answer
303 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 ...
Clive Portman's user avatar
2 votes
1 answer
337 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....
Ole's user avatar
  • 245
4 votes
1 answer
496 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 ...
Chris MacDonald's user avatar
1 vote
1 answer
968 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 ...
Steve Rowling's user avatar
1 vote
1 answer
286 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 ...
Mats Mikkel Rummelhoff's user avatar
1 vote
2 answers
546 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->...
Damon's user avatar
  • 4,706
0 votes
1 answer
461 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.
Ragnarsson's user avatar
1 vote
0 answers
157 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 ...
toffeejay's user avatar
  • 119
1 vote
1 answer
563 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 ...
Bowenac's user avatar
  • 811
4 votes
3 answers
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 ...
Neal Magee's user avatar
1 vote
1 answer
766 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('...
Russ Back's user avatar
  • 1,503
1 vote
1 answer
466 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 ...
ConquestXD's user avatar
1 vote
1 answer
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->...
Russ Back's user avatar
  • 1,503
4 votes
2 answers
3k 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 ...
Adam McCombs's user avatar
  • 1,695
1 vote
1 answer
513 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,
Mart's user avatar
  • 58
4 votes
2 answers
4k 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 ...
Ben Croker's user avatar
  • 7,411
2 votes
2 answers
212 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 ...
user814584's user avatar
6 votes
4 answers
10k 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 ...
Tim Kelty's user avatar
  • 3,081
4 votes
1 answer
274 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 ...
Lindsey D's user avatar
  • 24k