### Initialize Google Sign-In Source: https://www.ranksper.com/blog/google-site-kit Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### Initialize Google Sign-In Source: https://www.ranksper.com/blog/blog-post-introduction Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### Plugin Functionality and Configuration Source: https://www.ranksper.com/blog/google-site-kit This section details the plugin's features, integration capabilities, setup processes, user access, and data handling, presented as API documentation. ```APIDOC PluginIntegration: compatibility: "Integrates smoothly with most WordPress setups, ensuring no conflict with popular SEO or caching tools." SetupAndVerification: verifyWebsiteOwnership: "Ownership verification happens automatically when connecting Search Console through the plugin. No manual code insertion is required. Follow guided authentication steps." FeatureAvailability: pageSpeedInsights: "Core Web Vitals data is available directly in the dashboard alongside traffic and search performance metrics." conversionTracking: "While the plugin displays campaign performance data, detailed conversion tracking requires additional setup in your Google Ads account for full functionality." ServiceManagement: disconnectService: "Disconnecting a service (e.g., Analytics) removes its data widgets from the dashboard but does not affect your actual account settings or historical data stored in Google's platforms." UserAccess: dashboardVisibility: "Dashboard visibility follows WordPress user roles. Administrators control which team members see specific data through role-based permissions." DataRefresh: trafficDataUpdate: "Metrics refresh every few hours, matching Google's standard data processing timelines. Real-time stats require direct access to Analytics." RelatedFeatures: - "Drag-and-drop widgets for prioritizing data." - "Date-range filters for comparisons." - "Custom segments for user groups." - "Zero-friction design to avoid managing multiple dashboards." - "Real-time console data and conversion stats." UsageExample: // Example of checking compatibility and feature availability checkPluginFeatures() { if (PluginIntegration.compatibility === 'high') { console.log('Plugin is compatible.'); if (FeatureAvailability.pageSpeedInsights === 'available') { console.log('PageSpeed Insights data is accessible.'); } } } ``` -------------------------------- ### CSS Rule for Responsive Image Sizing Source: https://www.ranksper.com/blog/google-site-kit This CSS rule applies intrinsic sizing to images based on their 'sizes' attribute, ensuring proper rendering for responsive images. It targets images where the 'sizes' attribute is 'auto' or starts with 'auto,'. ```css img:is([sizes="auto" i], [sizes^="auto," i]) { contain-intrinsic-size: 3000px 1500px } ``` -------------------------------- ### WooCommerce JavaScript Initialization Source: https://www.ranksper.com/blog/google-site-kit Ensures the WooCommerce JavaScript class is applied to the body element. This is a common practice to enable WooCommerce-specific JavaScript functionalities on the frontend. ```javascript (function () { var c = document.body.className; c = c.replace(/woocommerce-no-js/, 'woocommerce-js'); document.body.className = c; })(); ``` -------------------------------- ### Initialize Google Sign-In Source: https://www.ranksper.com/blog/quality-content Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### WooCommerce Form Styling Source: https://www.ranksper.com/blog/google-site-kit Ensures required fields in WooCommerce forms are visibly marked. This snippet targets the visibility of the 'required' indicator for form input fields. ```css .woocommerce form .form-row .required { visibility: visible; } ``` -------------------------------- ### Initialize Google Sign-In Source: https://www.ranksper.com/blog/site-structure Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### AJAX and Theme Configuration Source: https://www.ranksper.com/blog/google-site-kit Defines configuration objects for AJAX requests and theme settings. Includes AJAX URLs for WordPress admin-ajax.php and theme-specific properties like RTL support. ```javascript var ajax_params = {"ajax_url":"https:\/\/www.ranksper.com\/wp-admin\/admin-ajax.php"}; var neuros_ajaxurl = {"url":"https:\/\/www.ranksper.com\/wp-admin\/admin-ajax.php"}; var theme = {"rtl":""}; ``` -------------------------------- ### Initialize Google Sign-In Source: https://www.ranksper.com/blog/content-plan Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### WordPress Color and Gradient Presets Source: https://www.ranksper.com/blog/google-site-kit Defines CSS variables for WordPress color presets and applies them to background and border colors for various blocks. Includes styles for gradient backgrounds. ```css .has-vivid-green-cyan-background-color{background-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-background-color{background-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-background-color{background-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-background-color{background-color: var(--wp--preset--color--vivid-purple) !important;}.has-black-border-color{border-color: var(--wp--preset--color--black) !important;}.has-cyan-bluish-gray-border-color{border-color: var(--wp--preset--color--cyan-bluish-gray) !important;}.has-white-border-color{border-color: var(--wp--preset--color--white) !important;}.has-pale-pink-border-color{border-color: var(--wp--preset--color--pale-pink) !important;}.has-vivid-red-border-color{border-color: var(--wp--preset--color--vivid-red) !important;}.has-luminous-vivid-orange-border-color{border-color: var(--wp--preset--color--luminous-vivid-orange) !important;}.has-luminous-vivid-amber-border-color{border-color: var(--wp--preset--color--luminous-vivid-amber) !important;}.has-light-green-cyan-border-color{border-color: var(--wp--preset--color--light-green-cyan) !important;}.has-vivid-green-cyan-border-color{border-color: var(--wp--preset--color--vivid-green-cyan) !important;}.has-pale-cyan-blue-border-color{border-color: var(--wp--preset--color--pale-cyan-blue) !important;}.has-vivid-cyan-blue-border-color{border-color: var(--wp--preset--color--vivid-cyan-blue) !important;}.has-vivid-purple-border-color{border-color: var(--wp--preset--color--vivid-purple) !important;}.has-vivid-cyan-blue-to-vivid-purple-gradient-background{background: var(--wp--preset--gradient--vivid-cyan-blue-to-vivid-purple) !important;}.has-light-green-cyan-to-vivid-green-cyan-gradient-background{background: var(--wp--preset--gradient--light-green-cyan-to-vivid-green-cyan) !important;}.has-luminous-vivid-amber-to-luminous-vivid-orange-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-amber-to-luminous-vivid-orange) !important;}.has-luminous-vivid-orange-to-vivid-red-gradient-background{background: var(--wp--preset--gradient--luminous-vivid-orange-to-vivid-red) !important;}.has-very-light-gray-to-cyan-bluish-gray-gradient-background{background: var(--wp--preset--gradient--very-light-gray-to-cyan-bluish-gray) !important;}.has-cool-to-warm-spectrum-gradient-background{background: var(--wp--preset--gradient--cool-to-warm-spectrum) !important;}.has-blush-light-purple-gradient-background{background: var(--wp--preset--gradient--blush-light-purple) !important;}.has-blush-bordeaux-gradient-background{background: var(--wp--preset--gradient--blush-bordeaux) !important;}.has-luminous-dusk-gradient-background{background: var(--wp--preset--gradient--luminous-dusk) !important;}.has-pale-ocean-gradient-background{background: var(--wp--preset--gradient--pale-ocean) !important;}.has-electric-grass-gradient-background{background: var(--wp--preset--gradient--electric-grass) !important;}.has-midnight-gradient-background{background: var(--wp--preset--gradient--midnight) !important;} ``` -------------------------------- ### Initialize Google Sign-In Source: https://www.ranksper.com/blog/headless-cms-vs-traditional-cms Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### Initialize Google Sign-In Source: https://www.ranksper.com/blog/blog-post-ideas Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### robots.txt for Controlled Access Source: https://www.ranksper.com/blog/ai-crawlers Example of a robots.txt file configuration to control crawler access to specific parts of a website. This allows public content to be indexed while protecting private or sensitive areas from AI crawlers. ```robots.txt User-agent: * Disallow: /admin/ Disallow: /private/ User-agent: GPTBot Allow: / User-agent: ClaudeBot Allow: / User-agent: PerplexityBot Allow: / Sitemap: https://example.com/sitemap.xml ``` -------------------------------- ### Initialize Google Sign-In Source: https://www.ranksper.com/blog/keywords-vs-search-terms Initializes the Google Identity Services library and renders the Sign-In with Google button. Handles credential responses by sending them to the server for authentication via a POST request. ```javascript async function handleCredentialResponse(response) { response.integration = 'woocommerce'; try { const res = await fetch('https://www.ranksper.com/wp-login.php?action=googlesitekit_auth', { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: new URLSearchParams(response) }); if (res.ok && res.redirected) { location.assign(res.url); } } catch (error) { console.error(error); } } google.accounts.id.initialize({ client_id: '175937229783-e9gb81asbibug462p8s5l9rqg5uq152r.apps.googleusercontent.com', callback: handleCredentialResponse, library_name: 'Site-Kit' }); document.querySelectorAll('.googlesitekit-sign-in-with-google__frontend-output-button').forEach((siwgButtonDiv) => { google.accounts.id.renderButton(siwgButtonDiv, { "theme": "outline", "text": "signin_with", "shape": "rectangular" }); }); ``` -------------------------------- ### WooCommerce General Parameters Source: https://www.ranksper.com/blog/how-to-start-career-in-digital-marketing General WooCommerce parameters, including AJAX URLs and internationalization strings for password visibility. ```javascript var woocommerce_params = { "ajax_url": "\/wp-admin\/admin-ajax.php", "wc_ajax_url": "\/?wc-ajax=%%endpoint%%", "i18n_password_show": "Show password", "i18n_password_hide": "Hide password" }; ``` -------------------------------- ### WooCommerce General Parameters (JavaScript) Source: https://www.ranksper.com/blog/google-site-kit Defines a JavaScript object holding general WooCommerce parameters for site-wide functionality. This includes AJAX URLs and internationalization strings for password visibility toggles. ```javascript var woocommerce_params = { "ajax_url": "\/wp-admin\/admin-ajax.php", "wc_ajax_url": "\/?wc-ajax=%%endpoint%%", "i18n_password_show": "Show password", "i18n_password_hide": "Hide password" }; ```