Gatemi Social Proof Developer Reference

The two editions use different filter prefixes: gmspf_ in the free edition and gmsp_ in the full edition. The behaviour is the same.

Filters

gmspf_feed / gmsp_feed

The notifications a page ships, just before they are handed to the script.

Argument Type
$items array[] Each with name, city, product, url, image, at

Whatever you return is redacted again to those six fields, so a filter can reorder, shorten or drop notifications but cannot add a field.

// Only notifications with a town.
add_filter( 'gmsp_feed', function ( $items ) {
	return array_values( array_filter( $items, function ( $item ) {
		return '' !== $item['city'];
	} ) );
} );

gmspf_include_order / gmsp_include_order

Whether one order becomes a notification. Applied while the feed is built, after the exclusions.

Argument Type
$include bool true
$order WC_Order The order
// Leave out wholesale customers.
add_filter( 'gmsp_include_order', function ( $include, $order ) {
	$user = $order->get_user();
	return $include && ! ( $user && in_array( 'wholesale_customer', (array) $user->roles, true ) );
}, 10, 2 );

Because the feed is built on cron, a change here shows after the next rebuild.

Full edition only

  • gmsp_settings — the merged settings array, after defaults.
  • gmsp_modules — the modules booted.
  • gmsp_license_api_url, gmsp_update_cache_ttl, gmsp_update_retry_ttl, gmsp_sync_cache_ttl — licence server address and cache lifetimes.

Actions — Full edition

  • gmsp_booted — after every module has booted; receives the plugin's container.

Options

Option Holds Edition
gmsp_settings Settings (shared shape) Both
gmsp_feed The built, redacted feed Both
gmsp_counts Product id ⇒ units sold in the window Full edition writes it
gmsp_license Licence state Full edition

There are no tables, no post meta and no order meta.

Cron hooks

Hook Edition When
gmspf_rebuild Free Hourly, while popups are on
gmspf_rebuild_once Free One minute after an order reaches or leaves a counted status, or is refunded
gmsp_rebuild Full Hourly, while popups or the counter are on
gmsp_rebuild_once Full One minute after an order reaches or leaves a counted status, or is refunded
gmsp_license_check Full Twice daily, only while a key is entered

To force a rebuild while testing:

do_action( 'gmsp_rebuild' );   // full edition
do_action( 'gmspf_rebuild' );  // free edition

Script and data

Both editions register the script and stylesheet under the handle gmsp-proof, enqueued from wp_footer only on pages that will show popups. The data object is window.gmspfData (free) or window.gmspData (full): items, delay, interval, position, the sentence templates withCity and noCity, the ago strings and now (the server's timestamp).

There is no REST route and no admin-ajax action.

CSS classes worth styling

Class Element
.gmsp-popup The popup, with gmsp-popup--bottom-left (and, in the full edition, --bottom-right, --top-left, --top-right)
.gmsp-popup__image The thumbnail (full edition)
.gmsp-popup__body Text wrapper
.gmsp-popup__text "Sarah in Leeds bought …"
.gmsp-popup__ago "5 minutes ago"
.gmsp-popup__close The close button
.gmsp-counter The product-page counter line (full edition)
.gmsp-popup { border-radius: 0; box-shadow: none; border: 1px solid #ddd; }
Shopping Cart
Scroll to Top