The GDPR Cookie Consent plugin helps to create a cookie notification bar on a WordPress Website and take consent to the use of cookies. It also helps easily customize the components of the cookie bar. In addition to this, the plugin gives great flexibility with shortcodes for multiple purposes that can be used on any page or post on the website.
Getting started
- From your WordPress dashboard, got to GDPR Cooke consent > Settings.
- Move on to the Customise cookie bar tab.
- The text message and appearance of the cookie notice bar can be customized from this tab. You can specify the required shortcodes in the Message text box.
Below are all of the shortcodes used in the GDPR Cookie Consent plugin and what they are used for.
Cookie Bar Shortcodes
[cookie_accept]
This shortcode adds an Accept button that is already styled in green color and closes the header when clicked on. The shortcode can be used on the cookie notification bar to take the consent of the user.
You can change the color of the Accept button from the set of pre-defined values for the colour attribute. You can choose from the colours red, blue, yellow, orange, green, or pink. Make sure to use the UK spelling of ‘colour’.
[cookie_button]
This shortcode adds the Accept button wherever it is applied from the backend of the website. Clicking on the button will register the consent for the usage of the cookies. The button added using this shortcode can be customized with the customization options given in the Accept section of the Customize Buttons tab or from the Themes tab on the Cookie Law Settings page.
[cookie_settings]
This is the cookie settings button rendering shortcode. The Settings button gives the users the granular control over the categories of cookies that they want to give consent to. When the user clicks on the Settings button, the user is shown a popup where they can select which cookie categories that they want to accept.
[cookie_reject]
This shortcode adds the Reject button that can be customized from the Cookie Law Settings page. The reject buttons thus added records the denial of the user to the use of any cookies by the website, when clicked upon.
[cookie_link]
This simple shortcode can be used to add the Read More link that can be linked to another URL or page on the website. This shortcode can be used to provide a link that can be redirected to the website’s privacy policy page. The URL or the page to which the shortcode links to is added from the Read More Link section under the Customize Buttons tab or from the Themes tab on the Cookie Law Settings page. The link can also be customized from the same page.
[cookie_close]
This shortcode adds a Close button to the Cookie Notice bar. The close action will be treated as the user’s consent. The close button can be further customized from the Themes tab of the Cookie Law Settings page.
Other Shortcodes
[cookie_audit]
Since the website owner is required to inform the users of the cookies that are used in the website, this simple shortcode can be used to display all the cookies and its related details to be displayed in a tabular format wherever the shortcode is added. You can add the shortcode to your privacy policy page to inform the users of the cookies that are used on the website.
Cookie | Type | Duration | Description |
---|---|---|---|
__cfruid | session | Cloudflare sets this cookie to identify trusted web traffic. | |
__stripe_mid | 1 year | Stripe sets this cookie cookie to process payments. | |
__stripe_sid | 30 minutes | Stripe sets this cookie cookie to process payments. | |
_fbp | 0 | 2 months | This cookie is set by Facebook to deliver advertisements when they are on Facebook or on a digital platform powered by Facebook advertising after visiting this website. |
_ga | 0 | 2 years | This cookie is installed by Google Analytics. The cookie is used to calculate visitor, session, campaign data and keep track of site usage for the site's analytics report. The cookies store information anonymously and assigns a randomly generated number to identify unique visitors. |
_ga_BQH8MSKD4M | 2 years | This cookie is installed by Google Analytics. | |
_gat_gtag | 0 | 1 minute | Identification code of website for tracking visits. |
_gh_sess | 1 | This cookie is used to preserve users' states across page requests. | |
_gid | 0 | 1 day | This cookie is installed by Google Analytics. The cookie is used to store information on how visitors use a website and helps in creating an analytics report of how the website is doing. The data collected including the number visitors, the source where they have come from, and the pages visited in an anonymous form. |
_hjAbsoluteSessionInProgress | 30 minutes | Hotjar sets this cookie to detect the first pageview session of a user. This is a True/False flag set by the cookie. | |
_hjFirstSeen | 30 minutes | Hotjar sets this cookie to identify a new user’s first session. It stores a true/false value, indicating whether it was the first time Hotjar saw this user. | |
_hjid | 0 | 11 months | Hotjar cookie. This cookie is set when the customer first lands on a page with the Hotjar script. It is used to persist the random user ID, unique to that site on the browser. This ensures that behavior in subsequent visits to the same site will be attributed to the same user ID. |
_hjIncludedInPageviewSample | 2 minutes | Hotjar sets this cookie to know whether a user is included in the data sampling defined by the site's pageview limit. | |
_hjIncludedInSample | 0 | This cookie is set to let Hotjar know whether that visitor is included in the sample which is used to generate heatmaps, funnels, recordings, etc. | |
_hjIncludedInSessionSample | 2 minutes | Hotjar sets this cookie to know whether a user is included in the data sampling defined by the site's daily session limit. | |
_hjSession_1376571 | 30 minutes | No description | |
_hjSessionUser_1376571 | 1 year | No description | |
_hjTLDTest | session | To determine the most generic cookie path that has to be used instead of the page hostname, Hotjar sets the _hjTLDTest cookie to store different URL substring alternatives until it fails. | |
_octo | 1 year | No description available. | |
_zendesk_authenticated | past | No description | |
_zendesk_session | session | No description available. | |
_zendesk_shared_session | session | No description available. | |
CONSENT | 2 years | YouTube sets this cookie via embedded youtube-videos and registers anonymous statistical data. | |
cookielawinfo-checkbox-advertisement | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category . | |
cookielawinfo-checkbox-analytics | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Analytics" category . | |
cookielawinfo-checkbox-necessary | 1 year | Set by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Necessary" category . | |
cookielawinfo-checkbox-preferences | 1 year | This cookie is set by the GDPR Cookie Consent plugin to check if the user has given consent to use cookies under the "Preferences" category. | |
CookieLawInfoConsent | 1 year | Records the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie. | |
edd_wp_session | 12 hours | No description available. | |
fr | 1 | 2 months | The cookie is set by Facebook to show relevant advertisements to the users and measure and improve the advertisements. The cookie also tracks the behavior of the user across the web on sites that have Facebook Pixel or Facebook social plugin. |
has_recent_activity | 0 | 1 hour | This cookie is used to signal to the code repository website if the user has browsed other website resources during the current session. |
logged_in | 1 year | No description available. | |
m | 2 years | No description available. | |
PHPSESSID | 0 | This cookie is native to PHP applications. The cookie is used to store and identify a users' unique session ID for the purpose of managing user sessions on the website. The cookie is a session cookie and is deleted when all the browser windows are closed. | |
tk_ai | 0 | 4 years | Gathers information for our own first-party analytics tool about how our services are used. A collection of internal metrics for user activity and is used to improve user experience. |
tk_lr | 0 | 11 months | This cookie is set by the JetPack plugin on sites using WooCommerce. This is a referral cookie used for analyzing referrer behavior for Jetpack. |
tk_or | 0 | 4 years | This cookie is set by the JetPack plugin on sites using WooCommerce. This is a referral cookie used for analyzing referrer behavior for Jetpack. |
tk_qs | 0 | 30 minutes | Gathers information for our own first-party analytics tool about how our services are used. A collection of internal metrics for user activity and is used to improve user experience. |
tk_r3d | 0 | 3 days | The cookie is installed by JetPack. Used for the internal metrics for user activities to improve user experience. |
viewed_cookie_policy | 0 | 1 hour | The cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not a user has consented to the use of cookies. It does not store any personal data. |
VISITOR_INFO1_LIVE | 5 months 27 days | A cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface. | |
YSC | session | YSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages. | |
yt-remote-connected-devices | never | YouTube sets this cookie to store the video preferences of the user using embedded YouTube video. | |
yt-remote-device-id | never | YouTube sets this cookie to store the video preferences of the user using embedded YouTube video. |
The shortcode takes the attributes style with values simple, classic, modern, rounded, elegant, winter. The table by default has the style classic. For example, the shortcode given below will add an audit table that looks as below.
[cookie_audit style="winter"]
To display a message in the table if there are cookies to display, you can use the attribute not_shown_message. For example:
[cookie_audit style="winter" not_shown_message="No cookies found"]
[cookie_audit_category]
This shortcode is also used for displaying the cookies that have been added to the plugin in a tabular format but organized into categories. The table will list the cookies according to the categories that they belong to as defined by the user.
[cookie_audit category="categoryslug"]
This shortcode can be used to list out the cookie list in each category description. For example, if you want to list out the cookies under the analytics category, you may go and edit the Analytics category and insert.
[cookie_audit category="analytics"]
[cookie_popup_content]
This shortcode can be used to display the popup that appears when the Settings button is clicked, wherever the shortcode is applied.
[delete_cookies] or [delete_cookies text="Click here to delete"]
This shortcode adds a link that when clicked upon deletes all the cookies that are specified in the plugin as a non-necessary cookie.
when the attribute text is used with the shortcode Delete Cookies the link looks as shown below:
[cookie_after_accept]Your Content goes here... [/cookie_after_accept]
Any content that is added in between these enclosing shortcodes will only be displayed if the cookie has been accepted. So this shortcode can be used to restrict any content to the users if they have not accepted the cookies.
[cookie_after_accept category=”category1-slug”]Your content goes here… [/cookie_after_accept]
The category attribute of the shortcode allows restricting the content enclosed based on the category of the cookies specified. More than one categories can be specified and the content will be visible if all the categories of the cookies are enabled. For example, if you specify two categories in the “category” attribute of the shortcode, say Analytics and Marketing, if the user disables the cookies in the Analytics category, the content inside the shortcode will not be made available to the users. It is only when both the categories are enabled, that the users are able to access the content.
[cookie_after_accept category=”category1-slug, category2-slug” condition=”or”]texts[/cookie_after_accept]
The attribute condition with value “or” allows you to display the content specified with the shortcode to be displayed in any of the categories mentioned are enabled. For example, if for there are two categories mentioned in the category attribute Analytics and Marketing, and the user enables any of the categories, the content inside the enclosing shortcodes will be made available to the users.
maria jose
March 20, 2024
Hi
How Can I show the date of the last cookies scan in the cookies poilicy page
Thanks in advance
MJose
Hema
April 2, 2024
Hello Maria,
Thanks for reaching out. This feature is currently not available in the plugin. We will make sure to add this to our backlog for feature updation.
MIGUEL
November 25, 2022
Can shortcodes be used in the new version?
Thanks.
Mark
December 4, 2022
Hi Miguel,
Greetings from Webtoffee!
The latest premium and free versions of our plugin will support these shortcodes. However, if you are referring to the latest revamped free plugin that is available for newer websites, these shortcodes will not work on it.
Terry
February 19, 2022
I am not a coder so i don’t how or were to put the short code [reject_all] so it shows up as a button. Can you advise please. I have tried a few things but it doesn’t work for me. Thank you
Mark
February 22, 2022
Hi Terry,
We are here to assist!
Kindly add the short code [reject_all] to GDPR Cookie Consent > Settings > Customise Cookie Bar > Cookie Bar > Message box.
Rodrigo
August 19, 2021
Hi Mark! I’m here trying to use the “cookie_after_accept” with the modifier “category=functional-XX” where XX is a language identifier.. i.e: functional-en, functional-br, functional-es (for english, brazilian portuguese and spanish)… well, all the translations work very good with the slugs… but the same don’t occur with de modifier “category”. Ps.: I tried with the modified and with the “original” slugs.
Its mandatory the “condition” modifier use? Let’s supose i have all my consents set to “Disable” and i want to show some content only after the user set “Functional cookies” to “Enabled”. However, the user only set the “Performance” to “Enabled”… My content is being shown the same way =/
Mark
August 30, 2021
Hi Rodrigo,
Thanks for reaching out!
As this is custom requirement rather than a public topic for open discussion, kindly submit a ticket here with a sample content that you want to run based on consent.
mirko
May 24, 2021
Help! Per errore ho cancellato la categoria “Necessario” e ora “Sempre abilitato” non compare più.
By mistake I deleted the “Necessary” category and now “Always enabled” no longer appears.
Mark
May 24, 2021
Hi Mirko,
You can create the category again and set the category slug as ‘necessary’ to get it back.
Tiago Tulha
May 2, 2021
Hi, is it possible to change the value from the button “save&accept”?
I need to translate it.
Thanks 🙂
Mark
May 3, 2021
Hi Tiago,
Please mention which version of the plugin you are using and to which language you want it translated to.
Olivier
March 17, 2021
Hello, i would like to add a “cookies” link in my footer.
When i click the link, i want to show the categories cookie popup. How can i do this
Mark
March 17, 2021
Hi Oliver,
You can use the short [wt_cli_manage_consent] to add the cookie settings link anywhere in the site.
Enrique
March 11, 2021
Hello! I need help…I have my scripts ready to enable cookies in case the user agrees but in spain the default state must be disabled so if I click on the accept button all cookies are not accepted because the state remains disabled, any solution please? Thank you very much in advance
(I use the standard version)
Mark
March 16, 2021
Hi Enrique,
Our premium version plugin has an option to enable accept all where you can enable all categories at once. Kindly check it out.
Dennis B.
February 21, 2021
hi, is it possible to use the [cookie_accept_all] Button next to the “Save&Accept” Button at the Cookie settings view?
So that the visitor can Save&Accept the current setting or allow all cookies.
Mark
February 26, 2021
Currently, there is no option to add an accept all button to settings pop up. Sorry to let you down.
Gustavo Keinemann
November 19, 2020
Hello! I am trying to use [cookie_accept_all] and I also use Polylang. The “ACCEPT ALL” label doesn’t show up at all in the string translations page. Is there a way to customize the message displayed in the other languages? I mean, in the string translations I can see where I need to translate the pop-up window’s text, but I tried using [cookie_accept_all message="testing"] and [cookie_accept_all cookie_accept_all_message="testing"] but it doesn’t work (wishful thinking on my part). In the string translations page I can see the text and translation for all the other buttons. If it matters, my site is in English, Spanish and German.
Any ideas? Thanks!
Mark
December 16, 2020
As the button was recently added, there are some updates missing with regards to polylang translation support. We will add it in the next update.
Rene
October 30, 2020
Does [cookie_accept] only accept the settings of existing categories or is this a global “accept”.
example:
cat 1 = enabled (default state)
cat 2 = disabled (default state) & no changes
Will [cookie_accept] accept cookies of cat 1 and cat 2 OR will it accept only cat 1?
Mark
November 3, 2020
It just accepts the current state of categories. In the premium version, you can enable the accept all feature.
Hoa
August 28, 2020
Hi,
I’m trying to enable the function “Enable accept all feature?” in the settings of the [cookie_button] but every time I save the settings and refresh the page, the setting jumps back to “No”. What is the reason for this? This message appears when I select “Yes” on this function:
“Please note that you will not be able to extend the cookie consent bar with cookie settings once this option is enabled.”
So I now removed the [cookie_settings] shortcode from my text, however this doesn’t seem to have any effect. The problem stays the same: my selection of “Yes” doesn’t save and instead gets replaced by “No”. Please help!
Many thanks
Hoa
Mark
September 1, 2020
It will not work with cookie bar or popup themes that has cookie category checkboxes on the banner itself.
Mick
August 19, 2020
Hi there,
Is it possible to change the Button Text “Save&Accept” in the Popup? [cookie_popup_content]
Thanks.
Mark
August 26, 2020
Are you looking to translate it and if yes, which language?
Karl
June 4, 2020
Hi,
Is there a shortcode that can be put in our cookie page that allows the user to edit their cookie settings? I know we can enable the settings tab, but we don’t want that on every page as it gets in the way of some site elements.
Thanks,
Karl
Karl
June 4, 2020
I’ve tried: [user_consent_state] which puts the current state and a link – but the link does nothing:
Manage your consent.
Mark
June 4, 2020
You can use the shortcode [cookie_popup_content] that shows the cookie settings content.
Jose
September 20, 2021
This shortcode not working in custom template.
Mark
September 21, 2021
Please share the site URL and mention where you are trying to add it.
Roy Berrevoets
January 17, 2020
Hi,
Is there a way to edit the design of the ‘Privacy Overview-Pop up’?
Thanks,
Roy
Mark
January 20, 2020
You can apply style via CSS in your site theme. Hope you would be able to identify the classes to apply style via browser inspect tool. For any particular requirement, please reach us via support.
Thomas
November 22, 2019
Hi there,
if you use the shortcode [cookie_after_accept]Your Content goes here… [/cookie_after_accept] will there be an text shown to the User that he need to accept cookies to see the content?
Mark
November 26, 2019
Hi,
Currently, we have shortcode support for iframe-based contents only.
jth
March 1, 2019
Hi,
All styles seems to have disappeared. The following code [cookie_audit style="modern" not_shown_message="No cookies set"] display the same kind of table regardless of the style= setting (see
https://www.composition-project.eu/cookies/
)It used to work, but there must have been an update that removed the templates?
Jesper
Mark
March 6, 2019
Hi,
We are sorry about the inconvenience. However, we can confirm that we haven’t made any recent changes in the styling that would affect the shortcode functionality.
Please submit a ticket in the above support link with your site details so that we can have a deeper look.
f.duroy
November 29, 2018
Hi,
Is there any shortcode to display the different cookies belonging to a category within the Privacy Overview pop up like shown here https://www.webtoffee.com/wp-content/uploads/2018/05/cookie-settings-popup-category-description.png
Or do we have to write down the name ?
Thanks
Mark
November 30, 2018
Hi,
The above article talks about 2 short codes ie [cookie_audit] and [cookie_audit_category]. One will display the full list of cookies and other lists the cookies category wise. You can use them in the privacy overview content.
Read above for more info.