• Trusted by 2,250,000+ users
  • 30-Day money back guarantee
  • 15+ years of experience
  • Woocommece, Elementor, Gutenberg, 6+

Cookie Tasting

by Tarosky INC.

1 Ratings

  • 5.0

Active Installations

10+

Last Update

4 years

Quality

D

Plugin Description

Description
This plugin sets user cookie when user is logged in.
You can use cookie as data store,
so you can use it as UI resource.
Visibility
This plugin adds class to
html
element.
ct-logged-in
The current user is logged in.
ct-not-logged-in
The current user is anonymous.
You can control elements visibility with CSS.
.some-element{
display: none;
}
.ct-logged-in .some-element{
display: block;
}
From JavaScript
You can use Global Object
CookieTasting
for utility.
CookieTasting.userName()
Returns user name. If not logged in, returns ‘Guest’.
CookieTasting.lastUpdated()
Returns timestamp of last log in check. If this equals 0, it means that user is anonymous.
Besides that, this plugin checks periodically log-in status.
You can handle it with jQuery.
jQuery( document ).on( ‘cookie.tasting’, function( event, response ) {
if ( response.login ) {
// User is logged in.
// If you use React…
setAttributes({ name: CookieTasting.userName() })
} else {
// User is not logged in.
}
} );
If you use react or something, updated the status with
setState()
.
Check Before Action
If you manage cached WordPress and customizing your own theme,
It’s a good idea to implement dynamic UI components with JavaScript.
You can check user’s credential just before important actions.
// Click action for button.
$(‘.read-more’).click( function( e ) {
e.preventDefault();
// Check cookie before do something.
CookieTasting.testBefore().then( function( response ) {
// Now user has fresh information.
// Load premium contents.
loadPremiumContents();
}).catch( function( response ) {
// This user is not logged in.
// Redirect them to login page.
window.locaion.href = ‘/wp-login.php’;
} );
} );
Plese remember adding dependency for
cookie-tasting-heartbeat
to your script.
Handle UUID
By default, this plugin set UUID for each user. This will be…
Unique for each logged in user and will be saved as user_meta.
Also kept for anonymous user.
So you can use it for Google Analytic’s User ID View.
const uuid = CookieTasting.get( ‘uuid’ );
// For Google Analytics.
ga( ‘set’, “userId”, uid );

Similar Plugins

  • Report Bug
The content on this website originates from various sources. All rights to the original content remain with the respective author. If you believe that your copyrights have been infringed by the use of content on this website, please contact us at info@plugin-guru.com. We will remove the content in question immediately.

This is the heading

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Collections

Create your first Collection

To create a collection, simply click on the symbol on the desired plugin.

You can see this symbol when you move the mouse over the plugin. 

Current Level

Plugin Magican

You have reached 0 views on your collections and are currently Plugin Magican. You magically help people find the right plugins and are a great asset to the community

0 of 500 views reached