Problem/Motivation

Google Analytics provides an option to set Cookie Flags such as SameSite=None and Secure but the module does not provide a way to enable these.

Steps to reproduce

N/A

Proposed resolution

Add options to set these flags, possibly with default values.

Remaining tasks

  • Implement new options
  • Determine appropriate default values

User interface changes

New options available to administrators. Updated HTML output.

API changes

None

Data model changes

None

CommentFileSizeAuthor
#9 google_analytics_cookie_flags.patch517 bytespr-lacity
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mstrelan created an issue. See original summary.

crystalgrafix’s picture

Hi, I tried adding this value under 'Advanced Settings'-> 'Create only fields'. However it says cookieFlags is not a valid property. Please let me know if there is a different method to add cookieFlags.

rot3r1’s picture

any update?

code-drupal’s picture

On save of config, it gives following error message
Create only field name cookieFlags is an unknown field name.

hubbs’s picture

I'm having the same issue.

I try to set cookieFlags|secure;samesite=none in "Advanced Settings > Custom Javascript Code > Parameters", but I get this error: Parameter name cookieFlags is unknown. Parameters are case sensitive. Please see documentation for supported parameters.

In D7 this error doesn't happen.

michael_garofalo’s picture

I am also getting the same error message as Hubbs when trying to perform the same action. Is there any update on if a similar patch to https://www.drupal.org/project/google_analytics/issues/3238348 ?

Would be ideal to have the cookieFlags and cookieUpdate added to the parameters.

dmorgan42’s picture

I think this should be marked as a bug fix rather than a feature request, since it appears to break ADFS (Active Directory Federation Services - e.g. SSO) logins in our organization when a GA cookie is set without the appropriate SameSite, Secure cookies set.

pr-lacity’s picture

StatusFileSize
new517 bytes

I have created a patch that allows the cookieFlags and cookie_flags to be added to the Custom Javascript Code section under Advanced Settings.

Example parameters: cookie_flags|secure

This patch works on both 8.x-3.1 and 4.0.2.

japerry’s picture

Status: Active » Closed (outdated)

With the sunset of legacy google analytics, the 8.x-3.x module is now unsupported. If this is still an issue with the 4.x version, please file a new issue in the queue.

plopesc’s picture

Status: Closed (outdated) » Needs review

This is still a thing in 4.0.3.

Patch from #9 helped us to define the cookie_flags

plopesc’s picture

Version: 8.x-3.x-dev » 4.x-dev