Wordpress
A description for your article
The WordPress plugin is a wrapper around the web components to offer user management, single purchase, and subscriptions.
The latest version of the plugin is available in the WordPress Store or directly here: https://assets.sesamy.com/scripts/wordpress-sesamy/sesamy-wordpress.zip
Pre Install Configuration
Before the plugin can be installed the following steps are required:
- Register a Sesamy client.
- Add a user as the admin of the client.
- Whitelist the domain of the website for the Sesamy indexing service.
Contact support@sesamy.com with the information about the domain and the user.
Configuration
Complete the installation process, and activate the plugin, as shown in the screenshot below.
Once the plugin is activated, the Sesamy configuration page is available in the WordPress admin.
The Sesamy configuration page contains the following settings:
- Client ID: Upon registration with Sesamy, the Client ID is provided by Sesamy support. The plugin relies on it for proper functionality.
- Content types: The content types for which the paywall will be applied.
- Lock mode: This setting determines the type of lock employed in the paywall implementation:
- SignedURL
- Embed
- Encode
- Event
- None
- Currency: This setting defines the currency globally, applicable to all content types.
- Sesamy Attributes: This setting defines the required attributes (tags, and user metadata) globally, extending its application to all content types.
- User paywall wizard by default: This enables the paywall wizard component for all locked content with a common configuration for all posts.
- Paywall Wizard Logo URL: Sets the path for the image shown at the top of the paywall wizard
- Paywall Wizard Title: The text block shown at the top of the paywall wizard
- Paywall Wizard Perks: The perks are shown as a list of selling point above the purchase options
- Paywall Wizard Single Purchase Description: The text displayed for articles that are available for single purchase.
Lock Modes
There are different solutions for locking the content depending on the customer's needs:
- SignedURL (default): The locked content is fetched per user from an API endpoint. This is the most secure option.
- Embed: The locked content is embedded on the public website. It is less secure but has SEO benefits as search engines will index the entire content.
- Encode: The locked content is embedded on the public website but in a base64 format. It makes it harder for instance ad-blockers or other tools to get access to the content by simply applying CSS rules.
- Event: A custom event is emitted when the article is unlocked but the locked content is not rendered. This is for instance used for integrating with existing paywalls.
- None: No paywall is displayed and the content of the article is not modified, but an event is emitted if the article is unlocked.
Sesamy Passes
A pass is used to provide access to multiple articles over a time period.
The passes can be defined directly in WordPress.
A Sesamy Pass has the following properties:
- Name: The readable name of the pass.
- Slug: The URL-friendly version of the name. This is used as the ID of the pass.
- Description: Comprehensive details about the pass features, aiding users in understanding its value proposition.
- Image: The image of the pass.
- Price: The price of the pass.
- Payment period: The payment period unit, for instance, month.
- Payment time: The number of payment periods for each payment.
- Public URL: A link to a page that describes the pass.
Sesamy Attributes
The custom Sesamy Attributes functionality provides a dynamic way to manage content access based on user-specific attributes. This feature allows for a more personalized and controlled content distribution, ensuring that users see content relevant to them or for which they are authorized. Attributes come in two types: tags and user metadata.
A Sesamy Attribute has the following properties:
- Name: A descriptive title that distinguishes the attribute.
- Slug: The URL-friendly identifier for the attribute, ensuring compatibility with web addresses.
- Description: Comprehensive details about the attribute's features, aiding users in understanding its value proposition.
- Attribute type: Attribute type refers to the characteristics associated with entities within the system. Attribute type can be edited after creation.
- None: If this option is selected, the required attribute will be searched among all the tags and the user metadata.
- Tag
- User Metadata
- window.sesamy.tags.list(): List all the tags assigned to the logged-in user.
- window.sesamy.tags.set(tagName: string): Set a new tag to the logged-in user.
- window.sesamy.userMetadata.list(): List all the tags assigned to the logged-in user.
- window.sesamy.userMetadata.get(userMetadataName: string): Get the value of a specific metadata field of the logged-in user.
- window.sesamy.userMetadata.set(userMetadataName: string, userMetadataValue: string | number): Set a new metadata field to the logged-in user.
Assigning Sesamy Attributes to Users
The attributes for the logged-in user can be managed manually with the sesamy-js library with the following API:
Tags
User Metadata:
Posts
Once the plugin is configured the paywall can be activated for a post.
The post has the flexibility to be linked with any of the passes you've defined.
It provides access to subscribers, while also offering the option for individual purchase, enabling users to acquire access to the content independently of a subscription.
The following attributes are showing in the post which was added by this plugin:
- Locked now: When this option is selected, the post is locked immediately If this option is selected then the "Locked From" date option is not shown.
- Locked from and Locked until: These dates specify the start and end points for when the post will be locked and unlocked.
- Single purchase: If selected, the locked content can be unlocked by the users paying the price defined in the next property.
- Price: The price is shown exclusively when the single purchase option is chosen; otherwise, the pricing is dictated by the Sesamy Pass selected by the user.
- Sesamy passes: The Sesamy passes are for a subscription payment.
- Access level: The access level attribute presents three options. This attribute determines which access level is required to access the locked content. The content container supports the following options:
- Entitlement (default): The user needs to have an entitlement matching the item or one of the passes to unlock the content.
- Public: The content is open to everyone.
- Logged In: The content is open to logged-in users. This Access Level is required to be used with the Sesamy Attributes.
- Sesamy Attributes: The required attributes that the user must have attached to their user to unlock the content. Only works with Logged In Access Level.
- Use paywall wizard: Enables the paywall wizard web component. The paywall wizard provides a good default customers experience and is recommended to use if you do not want to customize the paywall dialog in the the Wordpress theme.
- Override Paywall wizard default settings: The paywall wizard settings are normally fetched from the plugin configuration but it’s possible to override it for a specific post.
About Custom paywall design
When the paywall feature is activated, it restricts access to content by default. This is a screenshot of the default paywall for single purchases:
When the paywall is enabled, users can customize its design to their liking using the "sesamy_paywall" filter. This grants users the freedom to create a personalized experience that aligns with their preferences.
Sesame Paywall Filter
add_filter('sesamy_paywall', 'show_paywall', 11, 3); function show_paywall( $default_paywall, $post, $post_settings){ // Code for your custom layout. Please see /demo folder for a complete example }
- add_filter('sesamy_paywall', 'show_paywall', 11, 3);
- This line adds a filter hook named 'sesamy_paywall'.
- It specifies a callback function named 'show_paywall' to be executed when the filter is applied.
- The number '11' indicates the priority of this filter. Filters with a higher priority number will be executed later.
- The number '3' indicates the number of arguments the callback function expects.
function show_paywall( $default_paywall, $post, $post_settings){
- This defines the callback function 'show_paywall' that will be executed when the 'sesamy_paywall' filter is applied.
- It accepts three parameters:
- $default_paywall: The default paywall content.
- $post: The WordPress post object.
- $post_settings: Additional settings related to the post.
- Inside the 'show_paywall' function, you would typically include the code to customize the paywall layout or behavior based on the provided parameters. This could involve checking certain conditions related to the post or user and modifying the $default_paywall content accordingly.
You can customize the code of the function to match the style of your website, this is an example of how it can be done (the code applied can be found in the /demo folder):
In the screenshot provided above, we've customized the paywall utilizing this filter. The modifications include altering the background and displaying content in a single-row layout, enhancing the overall appearance and functionality.
You can find a demo filter example using the following link: https://github.com/sesamyab/wordpress-sesamy/blob/master/demo/themes/twentytwentytwo-child/functions.php
Preview
More-Block Integration: Include a 'more’-block to showcase a snippet of your article as an engaging preview.
Excerpt Utilization: If you prefer not to use the 'more’-block or it’s not available, Sesamy uses the article excerpt to show the preview content.
Last updated on August 4, 2021