setup
Install Storyplace

Integrating Storyplace SDK into Your Website

To enhance the functionality and user engagement on your website, integrate the Storyplace SDK. This guide provides a step-by-step approach for adding the SDK to your site and identifying users to ensure a personalized experience.

Step 1: Add the Storyplace SDK to Your Site

Begin by embedding the Storyplace SDK into your website. This is the foundational step to enable Storyplace features for your users.

<!-- Storyplace SDK -->
<script src="https://cdnjs.storyplace.io/storyplace-sdk.min.js" strategy="afterInteractive"></script>

Insert the above script tag in the <head> section of your HTML. This script loads the Storyplace SDK from a CDN, ensuring it's ready for use across your website.

Step 2: Identify Users

For a tailored user experience and to link user activities to their accounts, it's crucial to identify the users on your website.

<!-- Use the Storyplace SDK to identify the current user of your website -->
<script>
  Storyplace('identify', {
    appID: 'YOUR_APP_ID', // Replace 'YOUR_APP_ID' with your actual Storyplace appID
    user: {
      email: user.email, // User's email
      name: user.name, // User's name
      id: user.id, // User's unique identifier
 
      // Optional but recommended fields:
      avatarURL: user.avatarURL, // URL to the user's avatar image
      created: new Date(user.created).toISOString(), // User's account creation date in ISO format
    },
  });
</script>

Include this script where your users log in or in sections where they might interact with Storyplace functionalities. Ensure to replace placeholders like YOUR_APP_ID, user.email, user.name, user.id, etc., with the actual data pertaining to the logged-in user and your Storyplace project settings.

Locating Your appID

Your appID is a unique identifier assigned to your project by Storyplace. To find your appID:

  1. Log into your Storyplace account.
  2. Navigate to your project's settings.
  3. Your appID will be listed there.

By integrating the Storyplace SDK and accurately identifying users, you leverage the full suite of Storyplace features, enhancing user engagement and personalization on your website.