Sophi

plugin banner

WordPress VIP-compatible plugin for the Sophi.io Site Automation service.

Author:10up (profile at wordpress.org)
WordPress version required:6.0
WordPress version tested:6.2.4
Plugin version:1.3.2
Added to WordPress repository:26-04-2021
Last updated:16-06-2023
Rating, %:0
Rated by:0
Plugin URI:https://github.com/globeandmail/sophi-for-wor...
Total downloads:2 940
Active installs:10+
plugin download
Click to start download

Sophi.io is a suite of artificial intelligence (AI) tools developed by The Globe and Mail to help content publishers make important strategic and tactical decisions. The tools range from automated content curation engines to predictive analytics and paywall solutions.

Sophi-driven pages outperform human curated pages by a significant margin and free up publisher resources so that they can focus on finding the next story that matters. Invisible, automated curation of your home and section pages to streamline your team’s workflow. Continuously optimize the performance characteristics of the site based on demand and your brand, so the content is always the right fit.

Note that a Sophi.io account and related credentials are required in order to authorize and authenticate access within the plugin settings.

Highlights of Sophi.io service

  • An automation platform capable of transforming your business.
  • State of the art natural language processing to enable prediction and optimization.
  • Tomorrow’s publishers rely on Sophi to better understand their audience and make sure every pixel is used to drive value efficiently and effectively.
  • Sophi Automation: Automates your digital content curation to display your most valuable content in the most valuable places on your website, on social media and in newsletters.
  • Sophi Dive: Uses your historical data to help content publishers and editors determine what content to produce more or less of and what to stop doing all together — which enables intelligent decision-making around resource allocation.
  • Sophi Now: Equips you with analytics that provide real-time, tactical decision support that can tell you what content to promote more prominently, or less prominently; find out what’s over-performing and underperforming on a particular page; and find out why a particular article is doing well or not (for example, is it driving subscriptions, helping retain subscribers, getting traction on social media, search or newsletters, etc.) and where readers are coming from and going next on your website.
  • Sophi Next: Flags a short list of articles that have just been published (but not promoted anywhere) that are likely to be your most valuable content going forward. This helps editors decide which headlines to place on a particular page — helping them find the hidden gems.
  • Sophi for Paywalls: A fully dynamic, real-time paywall engine that understands both content and users and can optimize for several outcomes and offers simultaneously.

Usage

There are two potential ways to integrate Sophi Site Automation results with your WordPress site. The default approach includes a Sophi Site Automation block that integrates with get_posts by injecting Posts IDs via the posts_pre_query filter that gets fetched later to return the actual Posts. In the same fashion, you can integrate Sophi results with your WP_Query object by setting the sophi_curated_page and sophi_curated_widget query parameters.

More details on each of these two options are described below. If you are not certain on the best integration approach, considering the following:

Reasons to use the Site Automation block:
– No additional development effort needed for initial Sophi integration
– Immediate integration with Sophi Site Automation API and page/widget settings
– Basic block display settings allow for basic configurations (show/hide post excerpt, author name, post date, featured image)

Reasons to use the Query integration:
– Can implement more custom caching and content fallback options
– Can implement support into non-block editor setups
– Likely more flexible for headless setups
– Block editor is not in-use within your WordPress environment
– You need an integration with Category/Taxonomy Pages and cannot integrate using a sidebar widget

Site Automation block

You can utilize the Site Automation block by configuring the Site Automation page and widget names and adjusting block content and post meta settings to display Site Automation content on your site.

The Site Automation block comes with a barebone HTML output and styling. It’s made to be filtered using sophi_site_automation_block_output.

add_filter(
    'sophi_site_automation_block_output',
    function( $output, $curated_posts, $attributes, $content, $block ) {
        // ...
        return $new_output;
    },
    10,
    5
);

The Site Automation block will automatically add a data-sophi-feature=<widget_name> attribute for the rendered HTML content so Sophi can understand what content section is rendered on your site.

Query integration

The Site Automation block uses query integration under the hood. You can query for Sophi curated articles by passing sophi_curated_page and sophi_curated_widget to your WP_Query queries.

$the_query = new WP_Query( [
    'sophi_curated_page'   => 'page-name',
    'sophi_curated_widget' => 'widget-name',
] );

Note that you need to add data-sophi-feature=<widget_name> to the wrapper div of your post for Sophi to capture your widget better.

<div class="posts-wrapper" data-sophi-feature="trending">
    <!-- Post lists -->
</div>

Caveats

WordPress VIP and `WP_Query`

While the above query integration works just fine, it has been observed on WordPress VIP infrastructure that WP_Query may return latest posts instead of the posts curated by Sophi due to the Advanced Post Cache plugin used by the VIP platform. A workaround for this is to use get_posts() instead and as good practice to add a comment explaining the usage of it so that developers new to it don’t swap it for WP_Query. Also remember to whitelist get_posts by adding the following inline comment so that PHPCS doesn’t throw a warning:

phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.get_posts_get_posts<h3>Developer Documentation</h3>

Sophi for WordPress has an in-depth documentation site that details the available actions and filters found within the plugin. Visit the developer docs ☞

Debugging

If you are having difficulties with your Sophi integration, then we recommend utilizing the Debug Bar for Sophi plugin to help triage your Sophi Authentication, Sophi API integration, and CMS publish/update events.


Screenshots
FAQ
ChangeLog