AI助手支持GPT4.0
This plugin sets user cookie when user is logged in.
此插件在用户登录时设置用户cookie。
You can use cookie as data store,
您可以将cookie用作数据存储,
so you can use it as UI resource.
因此您可以将其用作UI资源。 p>
This plugin adds class to html element.
html
此插件将类添加到 html code>元素。 p>ct-logged-in The current user is logged in. ct-logged-in code>当前用户已登录。 li>ct-not-logged-in The current user is anonymous. ct-not-logged-in code>当前用户是匿名用户。 li> ul>You can control elements visibility with CSS.您可以使用CSS控制元素的可见性。 p>.some-element{ .some-element { display: none;显示:无;}}.ct-logged-in .some-element{ .ct-login .some-element { display: block;显示:块;}} pre>From JavaScript来自JavaScript h4>You can use Global Object CookieTasting for utility.您可以将全局对象 CookieTasting code>用于实用程序。 p>CookieTasting.userName() Returns user name. CookieTasting.userName() code>返回用户名。If not logged in, returns ‘Guest’.如果尚未登录,则返回“访客”。 li>CookieTasting.lastUpdated() Returns timestamp of last log in check. CookieTasting.lastUpdated() code>返回上次登录检查的时间戳。If this equals 0, it means that user is anonymous.如果该值等于0,则表示该用户是匿名用户。 li> ul>Besides that, this plugin checks periodically log-in status.此外,此插件会定期检查登录状态。You can handle it with jQuery.您可以使用jQuery处理它。 p>jQuery( document ).on( 'cookie.tasting', function( event, response ) { jQuery(document).on('cookie.tasting',function(event,response){ if ( response.login ) { 如果(response.login){ // User is logged in. //用户已登录。 // If you use React... //如果您使用React ... setAttributes({ name: CookieTasting.userName() }) setAttributes({名称:CookieTasting.userName()}) } else { }其他{ // User is not logged in. //用户未登录。 }}} );}); pre>If you use react or something, updated the status with setState().如果您使用react或其他方法,请使用 setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
html code>元素。 p>ct-logged-in The current user is logged in. ct-logged-in code>当前用户已登录。 li>ct-not-logged-in The current user is anonymous. ct-not-logged-in code>当前用户是匿名用户。 li> ul>You can control elements visibility with CSS.您可以使用CSS控制元素的可见性。 p>.some-element{ .some-element { display: none;显示:无;}}.ct-logged-in .some-element{ .ct-login .some-element { display: block;显示:块;}} pre>From JavaScript来自JavaScript h4>You can use Global Object CookieTasting for utility.您可以将全局对象 CookieTasting code>用于实用程序。 p>CookieTasting.userName() Returns user name. CookieTasting.userName() code>返回用户名。If not logged in, returns ‘Guest’.如果尚未登录,则返回“访客”。 li>CookieTasting.lastUpdated() Returns timestamp of last log in check. CookieTasting.lastUpdated() code>返回上次登录检查的时间戳。If this equals 0, it means that user is anonymous.如果该值等于0,则表示该用户是匿名用户。 li> ul>Besides that, this plugin checks periodically log-in status.此外,此插件会定期检查登录状态。You can handle it with jQuery.您可以使用jQuery处理它。 p>jQuery( document ).on( 'cookie.tasting', function( event, response ) { jQuery(document).on('cookie.tasting',function(event,response){ if ( response.login ) { 如果(response.login){ // User is logged in. //用户已登录。 // If you use React... //如果您使用React ... setAttributes({ name: CookieTasting.userName() }) setAttributes({名称:CookieTasting.userName()}) } else { }其他{ // User is not logged in. //用户未登录。 }}} );}); pre>If you use react or something, updated the status with setState().如果您使用react或其他方法,请使用 setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
ct-logged-in
ct-logged-in code>当前用户已登录。 li>ct-not-logged-in The current user is anonymous. ct-not-logged-in code>当前用户是匿名用户。 li>
ct-not-logged-in
ct-not-logged-in code>当前用户是匿名用户。 li>
ul>
You can control elements visibility with CSS.
您可以使用CSS控制元素的可见性。 p>
.some-element{ .some-element { display: none;显示:无;}}.ct-logged-in .some-element{ .ct-login .some-element { display: block;显示:块;}} pre>From JavaScript来自JavaScript h4>You can use Global Object CookieTasting for utility.您可以将全局对象 CookieTasting code>用于实用程序。 p>CookieTasting.userName() Returns user name. CookieTasting.userName() code>返回用户名。If not logged in, returns ‘Guest’.如果尚未登录,则返回“访客”。 li>CookieTasting.lastUpdated() Returns timestamp of last log in check. CookieTasting.lastUpdated() code>返回上次登录检查的时间戳。If this equals 0, it means that user is anonymous.如果该值等于0,则表示该用户是匿名用户。 li> ul>Besides that, this plugin checks periodically log-in status.此外,此插件会定期检查登录状态。You can handle it with jQuery.您可以使用jQuery处理它。 p>jQuery( document ).on( 'cookie.tasting', function( event, response ) { jQuery(document).on('cookie.tasting',function(event,response){ if ( response.login ) { 如果(response.login){ // User is logged in. //用户已登录。 // If you use React... //如果您使用React ... setAttributes({ name: CookieTasting.userName() }) setAttributes({名称:CookieTasting.userName()}) } else { }其他{ // User is not logged in. //用户未登录。 }}} );}); pre>If you use react or something, updated the status with setState().如果您使用react或其他方法,请使用 setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
.some-element { display: none;显示:无;}}.ct-logged-in .some-element{ .ct-login .some-element { display: block;显示:块;}
display: none;
显示:无;
}
.ct-logged-in .some-element{
.ct-login .some-element {
display: block;
显示:块;
} pre>
You can use Global Object CookieTasting for utility.
CookieTasting
您可以将全局对象 CookieTasting code>用于实用程序。 p>CookieTasting.userName() Returns user name. CookieTasting.userName() code>返回用户名。If not logged in, returns ‘Guest’.如果尚未登录,则返回“访客”。 li>CookieTasting.lastUpdated() Returns timestamp of last log in check. CookieTasting.lastUpdated() code>返回上次登录检查的时间戳。If this equals 0, it means that user is anonymous.如果该值等于0,则表示该用户是匿名用户。 li> ul>Besides that, this plugin checks periodically log-in status.此外,此插件会定期检查登录状态。You can handle it with jQuery.您可以使用jQuery处理它。 p>jQuery( document ).on( 'cookie.tasting', function( event, response ) { jQuery(document).on('cookie.tasting',function(event,response){ if ( response.login ) { 如果(response.login){ // User is logged in. //用户已登录。 // If you use React... //如果您使用React ... setAttributes({ name: CookieTasting.userName() }) setAttributes({名称:CookieTasting.userName()}) } else { }其他{ // User is not logged in. //用户未登录。 }}} );}); pre>If you use react or something, updated the status with setState().如果您使用react或其他方法,请使用 setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
CookieTasting code>用于实用程序。 p>CookieTasting.userName() Returns user name. CookieTasting.userName() code>返回用户名。If not logged in, returns ‘Guest’.如果尚未登录,则返回“访客”。 li>CookieTasting.lastUpdated() Returns timestamp of last log in check. CookieTasting.lastUpdated() code>返回上次登录检查的时间戳。If this equals 0, it means that user is anonymous.如果该值等于0,则表示该用户是匿名用户。 li> ul>Besides that, this plugin checks periodically log-in status.此外,此插件会定期检查登录状态。You can handle it with jQuery.您可以使用jQuery处理它。 p>jQuery( document ).on( 'cookie.tasting', function( event, response ) { jQuery(document).on('cookie.tasting',function(event,response){ if ( response.login ) { 如果(response.login){ // User is logged in. //用户已登录。 // If you use React... //如果您使用React ... setAttributes({ name: CookieTasting.userName() }) setAttributes({名称:CookieTasting.userName()}) } else { }其他{ // User is not logged in. //用户未登录。 }}} );}); pre>If you use react or something, updated the status with setState().如果您使用react或其他方法,请使用 setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
CookieTasting.userName()
CookieTasting.userName() code>返回用户名。If not logged in, returns ‘Guest’.
If not logged in, returns ‘Guest’.
如果尚未登录,则返回“访客”。 li>
CookieTasting.lastUpdated()
CookieTasting.lastUpdated() code>返回上次登录检查的时间戳。If this equals 0, it means that user is anonymous.
If this equals 0, it means that user is anonymous.
如果该值等于0,则表示该用户是匿名用户。 li>
Besides that, this plugin checks periodically log-in status.
此外,此插件会定期检查登录状态。
You can handle it with jQuery.
您可以使用jQuery处理它。 p>
jQuery( document ).on( 'cookie.tasting', function( event, response ) { jQuery(document).on('cookie.tasting',function(event,response){ if ( response.login ) { 如果(response.login){ // User is logged in. //用户已登录。 // If you use React... //如果您使用React ... setAttributes({ name: CookieTasting.userName() }) setAttributes({名称:CookieTasting.userName()}) } else { }其他{ // User is not logged in. //用户未登录。 }}} );}); pre>If you use react or something, updated the status with setState().如果您使用react或其他方法,请使用 setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
jQuery(document).on('cookie.tasting',function(event,response){ if ( response.login ) { 如果(response.login){ // User is logged in. //用户已登录。 // If you use React... //如果您使用React ... setAttributes({ name: CookieTasting.userName() }) setAttributes({名称:CookieTasting.userName()}) } else { }其他{ // User is not logged in. //用户未登录。 }}} );
if ( response.login ) {
如果(response.login){
// User is logged in.
//用户已登录。
// If you use React...
//如果您使用React ...
setAttributes({ name: CookieTasting.userName() })
setAttributes({名称:CookieTasting.userName()})
} else {
}其他{
// User is not logged in.
//用户未登录。
} );
}); pre>
If you use react or something, updated the status with setState().
setState()
如果您使用react或其他方法,请使用 setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
setState() code>更新状态。 p>Check Before Action操作前检查 h4>If you manage cached WordPress and customizing your own theme,如果您管理缓存的WordPress并自定义自己的主题,It’s a good idea to implement dynamic UI components with JavaScript.最好使用JavaScript来实现动态UI组件。 p>You can check user’s credential just before important actions.您可以在执行重要操作之前检查用户的凭据。 p>// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
If you manage cached WordPress and customizing your own theme,
如果您管理缓存的WordPress并自定义自己的主题,
It’s a good idea to implement dynamic UI components with JavaScript.
最好使用JavaScript来实现动态UI组件。 p>
You can check user’s credential just before important actions.
您可以在执行重要操作之前检查用户的凭据。 p>
// Click action for button. //单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );}); pre>Plese remember adding dependency for cookie-tasting-heartbeat to your script.请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
//单击按钮的操作。$('.read-more').click( function( e ) { $('。read-more')。click(function(e){ e.preventDefault(); e.preventDefault(); // Check cookie before do something. //在做某事之前检查cookie。 CookieTasting.testBefore().then( function( response ) { CookieTasting.testBefore()。then(function(response){ // Now user has fresh information. //现在,用户有了新的信息。 // Load premium contents. //加载高级内容。 loadPremiumContents(); loadPremiumContents(); }).catch( function( response ) { })。catch(function(response){ // This user is not logged in. //此用户尚未登录。 // Redirect them to login page. //将他们重定向到登录页面。 window.locaion.href = '/wp-login.php'; window.locaion.href ='/wp-login.php'; } );});} );
$('.read-more').click( function( e ) {
$('。read-more')。click(function(e){
e.preventDefault();
e.preventDefault();
// Check cookie before do something.
//在做某事之前检查cookie。
CookieTasting.testBefore().then( function( response ) {
CookieTasting.testBefore()。then(function(response){
// Now user has fresh information.
//现在,用户有了新的信息。
// Load premium contents.
//加载高级内容。
loadPremiumContents();
loadPremiumContents();
}).catch( function( response ) {
})。catch(function(response){
// This user is not logged in.
//此用户尚未登录。
// Redirect them to login page.
//将他们重定向到登录页面。
window.locaion.href = '/wp-login.php';
window.locaion.href ='/wp-login.php';
});
Plese remember adding dependency for cookie-tasting-heartbeat to your script.
cookie-tasting-heartbeat
请记住在脚本中添加 cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
cookie-tasting-heartbeat code>的依赖项。 p>Handle UUID处理UUID h4>By default, this plugin set UUID for each user.默认情况下,此插件为每个用户设置UUID。This will be…这将是... p>Unique for each logged in user and will be saved as user_meta.每个登录用户的唯一身份,并将另存为user_meta。 li>Also kept for anonymous user.还保留给匿名用户。 li> ul>So you can use it for Google Analytic’s User ID View.因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
By default, this plugin set UUID for each user.
默认情况下,此插件为每个用户设置UUID。
This will be…
这将是... p>
So you can use it for Google Analytic’s User ID View.
因此,您可以将其用于Google Analytic(分析)的用户ID视图。 p>
const uuid = CookieTasting.get( 'uuid' ); const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );ga('set',“ userId”,uid); pre>
const uuid = CookieTasting.get('uuid');// For Google Analytics.//对于Google Analytics(分析)。ga( 'set', "userId", uid );
// For Google Analytics.
//对于Google Analytics(分析)。
ga( 'set', "userId", uid );
ga('set',“ userId”,uid); pre>
wp-content/plugins
wp-content / plugins code>。 li>Go to WordPress admin screen and activate this plugin.转到WordPress管理屏幕并激活此插件。 li>
Recommendation: Search on WordPress admin screen and install it.
建议 strong>:在WordPress管理屏幕上搜索并安装。 p>
原文出处:http://www.sanshu.cn/a/8706.html
群主管理都是支付大佬