Meet Google’s consent requirements for EU, UK, and Switzerland with our Google-certified CMP for WordPress Buy Now

Home > Docs > GDPR Cookie Consent(Legacy Version) > Shortcodes used in GDPR Cookie Consent Plugin

Shortcodes used in GDPR Cookie Consent Plugin

Last updated on October 20, 2023

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

  1. From your WordPress dashboard, got to GDPR Cooke consent > Settings.
  2. Move on to the Customise cookie bar tab.
  3. 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_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.

Button using <a  role="button" tabindex="0" class="wt-cli-element cli_action_button cli-accept-button medium cli-plugin-button green" data-cli_action="accept" >Accept all</a> shortcode

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.

Accept button
[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. 

Settings Button
[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.

Reject button using <a id="wt-cli-reject-btn" tabindex="0" role='button' style="margin:5px 5px 5px 10px; border-radius:4px; padding:8px 25px; border-color:rgb(28, 45, 99); border-width:1px; font-size:14px;"  class="wt-cli-element medium cli-plugin-button cli-plugin-main-button cookie_action_close_header_reject cli_action_button"  data-cli_action="reject">Reject all</a>
[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.

Read more link using <a id="wt-cli-policy-link" tabindex="0" href="https://www.webtoffee.com" rel=nofollow style="display:inline-block; background:none; border-radius:0px; text-align:left; font-size:14px; padding:5px 8px; padding-left:5px; margin-left:0px; line-height:16px; border:solid 0px #fff; text-decoration:underline; font-weight:600;" target="_blank"  class="wt-cli-element wt-cli-element cli-plugin-main-link"  >Read More</a>
[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 audit table
Audit table using
CookieTypeDurationDescription
__cfruidsessionCloudflare sets this cookie to identify trusted web traffic.
__stripe_mid1 yearStripe sets this cookie cookie to process payments.
__stripe_sid30 minutesStripe sets this cookie cookie to process payments.
_fbp02 monthsThis 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.
_ga02 yearsThis 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_BQH8MSKD4M2 yearsThis cookie is installed by Google Analytics.
_gat_gtag01 minuteIdentification code of website for tracking visits.
_gh_sess1This cookie is used to preserve users' states across page requests.
_gid01 dayThis 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.
_hjAbsoluteSessionInProgress30 minutesHotjar sets this cookie to detect the first pageview session of a user. This is a True/False flag set by the cookie.
_hjFirstSeen30 minutesHotjar 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.
_hjid011 monthsHotjar 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.
_hjIncludedInPageviewSample2 minutesHotjar sets this cookie to know whether a user is included in the data sampling defined by the site's pageview limit.
_hjIncludedInSample0This cookie is set to let Hotjar know whether that visitor is included in the sample which is used to generate heatmaps, funnels, recordings, etc.
_hjIncludedInSessionSample2 minutesHotjar sets this cookie to know whether a user is included in the data sampling defined by the site's daily session limit.
_hjSession_137657130 minutesNo description
_hjSessionUser_13765711 yearNo description
_hjTLDTestsessionTo 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.
_octo1 yearNo description available.
_zendesk_authenticatedpastNo description
_zendesk_sessionsessionNo description available.
_zendesk_shared_sessionsessionNo description available.
CONSENT2 yearsYouTube sets this cookie via embedded youtube-videos and registers anonymous statistical data.
cookielawinfo-checkbox-advertisement1 yearSet by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Advertisement" category .
cookielawinfo-checkbox-analytics1 yearSet by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Analytics" category .
cookielawinfo-checkbox-necessary1 yearSet by the GDPR Cookie Consent plugin, this cookie is used to record the user consent for the cookies in the "Necessary" category .
cookielawinfo-checkbox-preferences1 yearThis cookie is set by the GDPR Cookie Consent plugin to check if the user has given consent to use cookies under the "Preferences" category.
CookieLawInfoConsent1 yearRecords the default button state of the corresponding category & the status of CCPA. It works only in coordination with the primary cookie.
edd_wp_session12 hoursNo description available.
fr12 monthsThe 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_activity01 hourThis cookie is used to signal to the code repository website if the user has browsed other website resources during the current session.
logged_in1 yearNo description available.
m2 yearsNo description available.
PHPSESSID0This 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_ai04 yearsGathers 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_lr011 monthsThis cookie is set by the JetPack plugin on sites using WooCommerce. This is a referral cookie used for analyzing referrer behavior for Jetpack.
tk_or04 yearsThis cookie is set by the JetPack plugin on sites using WooCommerce. This is a referral cookie used for analyzing referrer behavior for Jetpack.
tk_qs030 minutesGathers 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_r3d03 daysThe cookie is installed by JetPack. Used for the internal metrics for user activities to improve user experience.
viewed_cookie_policy01 hourThe 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_LIVE5 months 27 daysA cookie set by YouTube to measure bandwidth that determines whether the user gets the new or old player interface.
YSCsessionYSC cookie is set by Youtube and is used to track the views of embedded videos on Youtube pages.
yt-remote-connected-devicesneverYouTube sets this cookie to store the video preferences of the user using embedded YouTube video.
yt-remote-device-idneverYouTube sets this cookie to store the video preferences of the user using embedded YouTube video.
shortcode

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"]
Cookie audit table with style="winter"
Cookie audit table with 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 table with no cookies found
Cookie audit table with 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 table with cookie category
Cookie audit table with cookie category
[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.

Privacy Overview-Pop up
Privacy Overview-Pop up
[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.

Delete cookies link using <a href="" class="cookielawinfo-cookie-delete">Delete Cookies</a> shortcode

when the attribute text is used with the shortcode Delete Cookies the link looks as shown below:

Cookie delete link with text="click here to delete"
[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.