SourceCue Button for Google Preferred Sources

Description

SourceCue Button for Google Preferred Sources is a complete Google Preferred Sources WordPress plugin that helps publishers add a Preferred Source button, official Google badge, inline call-to-action, sticky banner, or floating alert to their WordPress website.

Readers can use these Google Preferred Sources buttons to open Google’s Preferred Sources experience and add an eligible domain or subdomain as one of their preferred sources in Google Search.

SourceCue supports all three Preferred Sources implementation approaches documented by Google: the Standard JavaScript button, an Advanced customizable interactive button, and a Deeplink to Google’s source preferences page. You can choose the method that fits your site, customize how the Preferred Source prompt looks, control exactly where and when it appears, and optionally measure engagement with privacy-conscious local analytics.

No coding is required for normal use. SourceCue can automatically display the Preferred Sources promotion, or you can place it manually with the Gutenberg block, shortcode, action hook, or PHP helpers.

SourceCue is an independent WordPress plugin and is not affiliated with, endorsed by, or sponsored by Google.

Three Google Preferred Sources implementation methods

Choose how visitors access Google’s Preferred Sources feature.

1. Standard Google button

Use Google’s documented Standard JavaScript implementation. Google renders the interactive Preferred Sources button and handles its supported localization.

2. Advanced custom interactive button

Create your own Preferred Source call-to-action while still starting Google’s documented interactive Preferred Sources flow.

SourceCue provides six ready-to-use design presets:

  • Outline
  • Solid black
  • Dark gradient
  • Orange gradient
  • Dashed action
  • Pill

Each preset is only a starting point. You can customize the button label, solid or gradient background, text color, border color, gradient colors, gradient angle, font size, font weight, horizontal and vertical padding, border radius, border width, and border style.

Button labels support the dynamic variables {site_name} and {domain}.

3. Deeplink

Use a regular link to Google’s source preferences page without requiring the Google Preferred Sources JavaScript SDK for that element.

The Deeplink can be displayed as:

  • Custom text/button
  • Official Google Preferred Sources badge

You can also choose whether the Deeplink opens in a new browser tab.

Official Google Preferred Sources badges

SourceCue includes the translated Preferred Sources badge assets supplied through Google’s Preferred Sources documentation.

Features include:

  • 17 supported badge languages
  • Automatic language selection
  • Manual badge-language selection
  • Light badge theme
  • Dark badge theme
  • Standard and Retina/high-density assets
  • Adjustable badge width from 40 to 676 pixels

The appropriate high-density asset is automatically available for Retina displays.

This makes it easy to add an official Preferred Sources badge without manually downloading, uploading, resizing, or managing multiple translated badge files.

Automatic Preferred Source button placement

SourceCue can automatically display your Add as Preferred Source promotion without editing your theme or inserting a shortcode into every article.

Automatic targeting options include:

  • Entire website
  • Posts only
  • Pages only
  • Front page only
  • Selected public post types
  • Custom targeting rules

For custom rules, you can select the post types that should be included and then apply additional exclusions.

Category and content exclusions

Need more control?

SourceCue includes searchable selectors that let you exclude:

  • Specific categories
  • Individual posts
  • Individual pages
  • Eligible custom-post-type entries

This allows large publishers to show the Google Preferred Sources button only where it makes sense instead of applying one global rule to every URL.

Inline Preferred Sources buttons

Automatically insert a Preferred Sources button, badge, or CTA directly into eligible content.

Available placements are:

  • Before content
  • After content
  • Before and after content

Inline button alignment can be set independently to:

  • Left
  • Center
  • Right

Inline content can run by itself or together with one global sticky banner or floating alert.

Simple inline output or customizable card

SourceCue provides two inline presentation styles.

Simple

Display only the Preferred Sources button or official badge.

Card

Create a complete in-content Preferred Sources call-to-action with:

  • Custom title
  • Custom subtitle
  • Preferred Sources button or badge
  • Card background color
  • Text color
  • Border color
  • Spacing controls
  • Card alignment

Titles and promotional text can use {site_name} and {domain} variables.

This makes it possible to build calls to action such as:

Stay connected with {site_name}

and:

Add {domain} as a preferred source in Google Search.

Sticky banners and floating alerts

SourceCue is not limited to buttons inside article content.

You can also promote Google Preferred Sources using:

  • Sticky top banner
  • Sticky bottom banner
  • Floating alert

Only one global banner or alert is enabled at a time, but it can operate together with automatic inline content.

Banner and alert buttons have independent Left, Center, and Right alignment controls.

Floating alerts can be placed at:

  • Top left
  • Top right
  • Bottom left
  • Bottom right

You can also configure the maximum alert width.

Display triggers

Control when a Sticky Banner or Floating Alert appears.

Available triggers include:

  • Immediately
  • After a configurable time delay
  • After the visitor reaches a configurable scroll percentage

This makes it possible to wait until a reader has engaged with an article before displaying the Preferred Sources invitation.

Inline article content is rendered with the content and is not delayed by these banner/alert triggers.

Desktop, tablet, and mobile visibility

Choose which device classes can see your Preferred Sources promotion:

  • Desktop
  • Tablet
  • Mobile

Device visibility uses responsive CSS rather than server-side user-agent detection, helping the display rules remain compatible with page caching.

Banner and alert dismissal controls

Sticky banners and floating alerts can include a close button.

After a visitor dismisses the promotion, SourceCue can:

  • Show it again on the next page view
  • Hide it for the current browser session
  • Hide it for a configurable number of days
  • Never show it again in that browser

Dismissal preferences use browser sessionStorage or localStorage rather than dismissal cookies.

Public Preferred Sources click counter

SourceCue can optionally display a public counter showing how many times visitors have clicked your Preferred Sources actions.

Customize:

  • Counter text
  • Counter position
  • Counter alignment
  • Counter color
  • Counter spacing
  • Whether zero should remain hidden

Use {count} inside the counter text, for example:

{count} readers clicked to add us

The counter can appear:

  • Above the button or badge
  • Below the button or badge
  • Beside the button or badge

The counter records button usage. It does not claim that Google confirmed a visitor completed the Preferred Source selection because Google does not provide the plugin with such a completion callback.

Optional local Preferred Sources analytics

SourceCue includes optional local analytics for Google Preferred Sources buttons.

Analytics is disabled by default.

When enabled, the plugin records aggregated daily statistics inside your own WordPress database rather than creating individual visitor profiles.

The 30-day analytics dashboard reports:

  • Impressions
  • Clicks
  • Dismissals
  • Click-through rate (CTR)

Analytics can also be broken down by placement:

  • Inline
  • Inline Card
  • Sticky Banner
  • Floating Alert

By implementation:

  • Standard Button
  • Custom Button
  • Official Badge
  • Text Deeplink

And by integration source:

  • Automatic placement
  • Shortcode
  • Gutenberg Block
  • Action Hook
  • PHP Helper
  • Manual / Other

SourceCue does not store IP addresses, visitor IDs, WordPress user IDs, cookies, or individual page-view records for its local analytics.

Gutenberg Preferred Source block

SourceCue includes a dedicated Gutenberg block.

Search for:

SourceCue Button for Google Preferred Sources

inside the WordPress Block Editor and place the Preferred Sources action wherever you need it.

The block uses the same central plugin configuration while allowing manual placement inside posts, pages, templates, and other block-supported content.

Preferred Sources shortcode

Use the shortcode:

[psbgs_preferred_source]

for manual placement in content, widgets, builders, or other shortcode-compatible areas.

Examples:

[psbgs_preferred_source mode="standard" theme="dark" align="center"]

[psbgs_preferred_source mode="custom" label="Add {site_name} as a Preferred Source"]

[psbgs_preferred_source mode="deeplink" deeplink_style="official_badge" badge_theme="dark" badge_lang="hi" badge_width="160"]

[psbgs_preferred_source mode="standard" presentation="alert" alert_position="bottom_right" trigger="scroll" scroll="35"]

[psbgs_preferred_source inline_style="card" inline_title="Stay connected with {site_name}" inline_subtitle="Add {domain} as a preferred source in Google Search."]

Live Preview

SourceCue includes a live admin preview so publishers can see their Preferred Sources presentation while configuring it.

Separate previews are available for:

  • Inline content
  • Banner / alert presentation

Changes update immediately in the settings interface.

The Standard Google button is represented by a preview placeholder, while official badge previews use the bundled badge asset.

Cache-friendly display controls

SourceCue includes several features designed for WordPress sites that use page caching.

Device visibility uses responsive CSS rather than server-side device detection.

The optional Main-query protection helps prevent automatic inline buttons from accidentally appearing in secondary loops, related-post sections, widgets, and many page-builder loops.

You can also hide automatic Preferred Sources promotions from logged-in users while editors and administrators work on the site.

Automatic cache purge integration

When a supported WordPress caching plugin is detected, SourceCue can optionally request a cache purge after Preferred Sources settings are saved.

This allows presentation changes to become visible without manually clearing the page cache.

No caching plugin is required to use SourceCue.

Performance-focused front-end assets

SourceCue keeps its front-end footprint controlled.

Features include:

  • Conditional front-end assets
  • Minified production CSS and JavaScript
  • CSS loaded only when plugin output is expected
  • No jQuery dependency
  • Option to disable SourceCue front-end CSS when your theme provides all required styling

Google’s Preferred Sources JavaScript SDK is loaded only when the selected implementation requires an interactive Google element.

Text Deeplink and locally served official-badge output do not require that SDK unless another interactive Preferred Sources element on the same page requires it.

Data Management

SourceCue provides dedicated controls for managing plugin data.

Administrators can:

  • Clear all aggregated analytics data
  • Reset the public click counter
  • Reset plugin settings to their defaults
  • Choose whether plugin database data should be removed during uninstall

Full cleanup is enabled by default.

When cleanup is enabled and SourceCue is deleted, the plugin removes its settings, public click counter, analytics database-version option, custom analytics table, and scheduled plugin events.

If an administrator intentionally wants to retain settings and analytics for a later reinstall, database cleanup can be disabled before uninstalling.

Scheduled plugin events are always removed when the plugin is uninstalled.

Frontend Debug Mode

For troubleshooting, SourceCue includes an optional Frontend Debug Mode.

When enabled, it can log Preferred Sources rendering decisions using the [PSBGS] prefix and provide a browser-console diagnostic snapshot.

If WordPress debug logging is configured, related PHP diagnostic messages can also appear in the WordPress debug log.

Debug Mode is intended for temporary troubleshooting and can be disabled during normal operation.

Developer-friendly Preferred Sources API

Developers can integrate SourceCue into themes and custom plugins without relying exclusively on automatic placement.

Available integration methods include:

PHP echo helper

psbgs_preferred_source_button( array( 'mode' => 'standard', 'align' => 'center' ) );

PHP return helper

$html = psbgs_get_preferred_source_button( array( 'mode' => 'deeplink' ) );

Action hook

do_action( 'psbgs_preferred_source_button', array( 'presentation' => 'sticky_bottom' ) );

SourceCue also provides filters for settings, button arguments, generated markup, Deeplink URLs, badge language and assets, supported post types, automatic-display decisions, and analytics retention.

Selected filters include:

  • psbgs_default_settings
  • psbgs_settings
  • psbgs_button_args
  • psbgs_button_html
  • psbgs_deeplink_url
  • psbgs_badge_language
  • psbgs_badge_asset_urls
  • psbgs_supported_post_types
  • psbgs_should_auto_display
  • psbgs_analytics_retention_days

Privacy-conscious by design

Local analytics is optional and disabled by default.

SourceCue’s own analytics does not build visitor profiles or store IP addresses, visitor identifiers, WordPress user IDs, analytics cookies, or individual page-view records.

Banner dismissal uses browser session or local storage rather than dismissal cookies.

When Standard or Advanced implementation is rendered, Google’s documented Preferred Sources publisher library is requested from Google. Deeplink mode can be used when a regular link or locally served official badge is preferred.

Full external-service and privacy information is included in the plugin documentation.

Who is SourceCue for?

SourceCue is designed for WordPress:

  • News publishers
  • Online magazines
  • Independent publishers
  • Bloggers
  • Educational websites
  • Editorial websites
  • Content creators
  • Media organizations
  • SEO teams
  • Website owners who publish content eligible for Google’s Preferred Sources feature

Whether you need a simple Add as Preferred Source button, an official translated Google Preferred Sources badge, an in-content CTA, a sticky promotion, a floating alert, or a complete Preferred Sources engagement setup with targeting and analytics, SourceCue provides these options from one WordPress settings screen.

Important Google Preferred Sources eligibility note

Google controls which websites are eligible for Preferred Sources.

SourceCue does not make a website eligible for the feature and does not guarantee Google Search rankings, impressions, traffic, Top Stories visibility, AI visibility, or other search-performance improvements.

Preferred Sources eligibility applies to eligible domains or subdomains. A path or subdirectory such as example.com/blog cannot be configured as a separately eligible source.

SourceCue’s purpose is to give WordPress publishers a flexible way to implement and promote Google’s publicly documented Preferred Sources functionality on their websites.

Shortcode

Basic usage:

[psbgs_preferred_source]

Examples:

[psbgs_preferred_source mode="standard" theme="dark" align="center"]

[psbgs_preferred_source mode="custom" label="Add {site_name} as a Preferred Source"]

[psbgs_preferred_source mode="deeplink" deeplink_style="official_badge" badge_theme="dark" badge_lang="hi" badge_width="160"]

[psbgs_preferred_source mode="standard" presentation="alert" alert_position="bottom_right" trigger="scroll" scroll="35"]

[psbgs_preferred_source inline_style="card" inline_title="Stay connected with {site_name}" inline_subtitle="Add {domain} as a preferred source in Google Search."]<h3>External services</h3>

This plugin integrates with Google’s Preferred Sources service. The external service is required only for the Google functionality selected by the site administrator.

Google Preferred Sources JavaScript SDK

When the Standard or Advanced JavaScript implementation is rendered, the visitor’s browser loads Google’s Preferred Sources publisher library from:

https://news.google.com/swg/js/v1/publisher.js

This browser request is made to Google and may transmit information normally included in a web request, such as the visitor’s IP address, user agent, and referrer, according to Google’s policies. The plugin does not proxy or store that request.

The SDK is not loaded for the text-deeplink or locally served official-badge implementation unless another interactive Preferred Sources element on the same page requires it.

Google source preferences

Preferred Sources actions ultimately use Google’s source preferences service at:

https://www.google.com/preferences/source

For deeplink mode, the configured source domain is included in the q query parameter when the visitor follows the link. Standard and Advanced modes use Google’s documented interactive flow.

Service documentation: https://developers.google.com/search/docs/appearance/preferred-sources

Google Privacy Policy: https://policies.google.com/privacy

Google Terms of Service: https://policies.google.com/terms

Privacy

Local analytics is disabled by default. When enabled, the plugin stores aggregated daily counters in the site’s WordPress database. It does not store IP addresses, visitor IDs, WordPress user IDs, cookies, or individual page-view rows for analytics.

The optional public click counter stores one aggregate integer. A click is not presented as proof that the visitor completed the selection inside Google.

Dismissal preferences use browser sessionStorage or localStorage, depending on the configured behavior.

The Google external-service behavior is described in the External services section above.

By default, uninstalling/deleting the plugin removes its settings, public click …

Blocks

This plugin provides 1 block.

  • SourceCue Button for Google Preferred Sources Add a Google Preferred Sources button, badge, inline card, sticky banner, or floating alert.

Installation

  1. Upload the plugin ZIP from Plugins > Add New > Upload Plugin, or install it from WordPress.org after publication.
  2. Activate “SourceCue Button for Google Preferred Sources”.
  3. Go to Settings > Preferred Sources.
  4. Confirm the source domain or subdomain and choose an implementation method.
  5. Configure display rules, presentation, and optional analytics.
  6. Save the settings and test the result on the front end.

FAQ

Is this plugin affiliated with Google?

No. It is an independent WordPress plugin that implements Google’s publicly documented Preferred Sources methods.

Does the plugin make my site eligible for Preferred Sources?

No. Google controls eligibility. Preferred Sources eligibility is domain/subdomain based, and a subdirectory such as example.com/blog is not a separately eligible source.

Which implementation should I use?

Google recommends the Standard JavaScript implementation. Use Advanced when you need a custom button design, or Deeplink when you want a regular link or locally served official badge.

Does this improve search rankings?

The plugin does not guarantee rankings or traffic. It only provides controls that help readers access Google’s Preferred Sources feature.

Does the plugin track visitors?

Optional analytics is disabled by default and uses aggregate local counters only. It does not build visitor profiles. Standard and Advanced modes do load Google’s documented external SDK when rendered; see External services for details.

Does the public counter show confirmed preferred-source selections?

No. It counts clicks on the Preferred Sources action. Google does not provide this plugin with a confirmed-completion callback for a successful selection.

Does the plugin use cookies for banner dismissal?

No. Dismissal settings use browser sessionStorage/localStorage.

Does it work with caching plugins?

The front-end visibility rules are designed to be cache friendly. The plugin also offers an optional cache purge after its settings are saved when a supported cache plugin is detected.

Does it require jQuery?

No.

What happens to plugin data when I uninstall it?

Full cleanup is enabled by default. Deleting the plugin removes its settings, public click counter, analytics database-version option, custom analytics table, and scheduled plugin events. You can turn off database cleanup in Advanced & Usage > Data Management if you intentionally want to keep the stored settings and analytics for a later reinstall. Scheduled plugin events are always removed because the plugin code will no longer be present.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“SourceCue Button for Google Preferred Sources” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.6.21

  • Resolved Plugin Check warnings for the Google SDK resource declaration and readme short-description length.

1.6.20

  • Renamed the plugin to SourceCue Button for Google Preferred Sources and updated the WordPress.org package identity and translation domain.

1.6.19

  • Updated plugin branding and translation domain for WordPress.org directory compliance.
  • Reworked frontend debug diagnostics to use the registered frontend JavaScript instead of directly printed script markup.
  • Updated Google SDK loading to use WordPress’s native async script strategy.

1.6.18

  • Fixed Gutenberg block selection by using the Block Editor useBlockProps() wrapper required for normal selection, toolbar, move, and remove behavior.
  • Reworked the editor-only placeholder to stay compact and centered instead of stretching across the full editor canvas.
  • Kept the server-rendered front-end block output and all existing block attributes unchanged.

1.6.16

  • Final WordPress.org submission audit and package cleanup.
  • Raised the minimum WordPress version to 6.3 to match Gutenberg Block API v3 requirements.
  • Improved multisite uninstall cleanup so each site honors its own data-retention setting while scheduled plugin events are always cleared.
  • Unschedules analytics cleanup automatically when local analytics is disabled.
  • Resets the promotion dismissal revision when plugin settings are reset, preventing stale browser dismissal state from hiding a fresh default configuration.
  • Clarified Google badge attribution and trademark wording without making unsupported licensing claims.

1.6.15

  • Enhanced frontend stylesheet theme isolation for banner, alert, and close dismissal controls.
  • Added high-specificity defensive resets to prevent aggressive third-party themes from overriding button styling.
  • Bumped asset cache version to ensure immediate cache invalidation across all browsers and CDN layers.

1.6.13

  • Resolved WordPress 6.7+ Just-In-Time translation loading notice by guarding early defaults and badge language queries prior to the init action.
  • Deferred analytics settings verification and background cron check to the init hook.
  • Modernized SQL database identifier escaping in the atomic counter update query using $wpdb->prepare %i placeholder.
  • Added full multisite network cleanup support to uninstall.php across all sub-sites.
  • Standardized internationalization sentence formatting and translators comment in the analytics dashboard chart tooltip.
  • Cleaned up redundant CSS rules and synchronized minified production stylesheets.
  • Prepared full compliance packaging for WordPress.org Plugin Directory submission under contributor profile souravpan.

1.6.12

  • WordPress.org Plugin Check compliance improvements for security, internationalization, block API compatibility, asset naming, database queries, resource versioning, and third-party cache integrations.

1.6.11

  • Fixed Standard Google button alignment on the live frontend so Banner / Alert and Inline left/center/right alignment applies to Google’s rendered declarative button container.

1.6.10

  • Updated fresh-install defaults to the requested Deeplink/official-badge, automatic display, inline, and floating-alert configuration.
  • Removed the custom interactive button shadow option and its renderer, preview, preset, and styling code.

1.6.9

  • Improved Sticky Top and Sticky Bottom banner layout so the promotional copy and action are centered as a compact group by default.
  • In sticky banners, the public click counter now appears directly below the promotional message instead of above or below the Preferred Sources action.
  • Counter placement for inline content and floating alerts is unchanged.
  • Updated the live preview to match the sticky-banner counter layout.

1.6.8

  • Added universal Inline button alignment (Left, Center, Right) for all implementation methods.
  • Added universal Banner / Alert button alignment (Left, Center, Right) for Sticky Top, Sticky Bottom, and Floating Alert.
  • Removed the implementation-specific Alignment control from Advanced Custom Interactive Button settings.
  • Fixed Hide counter when it is zero so zero remains hidden in frontend output and after JavaScript counter refreshes.
  • Reworked the Live Preview into separate Inline and Banner / Alert preview sections and widened the preview column for clearer rendering.

1.6.7

  • Restored the Inline placement selector as an always-visible control under Presentation.
  • Inline placement can be configured as Before content, After content, or Before and after content even before Inline is enabled.
  • No frontend placement or rendering features were removed.

1.6.6

  • Added independent Inline automatic placement plus one optional global promotion.
  • Inline can run together with Sticky Top, Sticky Bottom, or Floating Alert.
  • Only one banner/alert can be selected at a time, preventing banner/alert conflicts.
  • Existing 1.6.5 presentation choices are mapped safely to the new controls.

1.6.5

  • Removed all pre-directory settings/database migration code so this release behaves as a standalone fresh plugin.
  • Restored the simple v1.5-style boot lifecycle.
  • Moved automatic sticky-bottom/alert footer rendering to an earlier footer priority so markup exists before footer scripts execute.
  • Improved automatic inline compatibility by guarding against secondary content using the queried post ID instead of requiring in_the_loop() and is_main_query().
  • Added an opt-in Frontend Debug Mode under Advanced & Usage. It logs [PSBGS] rendering decisions and prints a browser-console DOM diagnostic snapshot.
  • Kept the canonical [psbgs_preferred_source] shortcode and current block namespace only; no legacy settings migration is performed.

1.6.4

  • Removed the custom interactive button icon feature completely.
  • Removed icon choice, icon position, icon style, trailing notification badge text, and badge color controls from the admin UI.
  • Removed icon/notification preview logic, SVG renderer markup, and related front-end/admin CSS.

1.6.1

  • Added an Advanced & Usage > Data Management section.
  • Added an enabled-by-default option to delete all plugin database data on uninstall, with an administrator-controlled retention choice.
  • Added a manual Clear analytics data action that removes aggregate rows while keeping the analytics table ready for future tracking.
  • Added a Data Management public click-counter reset control.
  • Added a Reset plugin settings action that restores defaults without deleting analytics or public click counts.
  • Added nonce/capability protection and confirmation prompts for destructive data-management actions.
  • Scheduled analytics cleanup events are always removed during uninstall, even when database retention is enabled.

1.6.0

  • Prepared the plugin for WordPress.org directory submission.
  • Prepared directory naming to use Google descriptively rather than as the initial brand term.
  • Changed globally accessible PHP identifiers, options, hooks, AJAX actions, asset handles, and block namespace to the five-letter psbgs/PSBGS prefix.
  • Added front-end AJAX nonces for optional local analytics and the public click counter.
  • Added activation/deactivation cleanup for scheduled analytics maintenance.
  • Added explicit external-service, privacy, third-party asset, trademark, and license documentation.
  • Updated the text domain, folder conventions, block namespace, canonical shortcode, and readme metadata for the proposed WordPress.org slug.
  • Updated compatibility metadata for WordPress 7.1.

1.5.1

  • Moved public click-counter settings to the Presentation tab.
  • Updated custom-button presets to use Preferred Sources-appropriate preview text and no preset-specific icons or notification count.

1.5.0

  • Added customizable public click counter.
  • Added editable custom interactive button templates with advanced border and gradient controls.
  • Reduced the official badge minimum width to 40px.

1.4.0

  • Added optional local aggregated analytics, cache integration, and conditional/minified production assets.

1.3.0

  • Added advanced display rules, triggers, sticky bottom banner, device controls, live preview, inline card mode, variables, and tabbed settings.

1.2.0

  • Added sticky top banner and floating alert presentation modes with dismissal controls.

1.1.0

  • Added official translated Google Preferred Sources badge assets with locale mapping, light/dark variants, and Retina support.

1.0.0

  • Initial plugin with Standard JavaScript, Advanced JavaScript, and Deeplink implementations plus shortcode, block, automatic placement, action hook, and PHP helpers.