Pelcro | Content Subscription Platform

Documentation

Welcome to Pelcro docs! Get familiar with the Pelcro products and explore their features:

API Documentation

The Pelcro API is organized around REST. Our API has predictable, resource-oriented URLs, and uses HTTP response codes to indicate API errors.

Learn More

JS SDK Documentation

Add Pelcro to your browser-based JavaScript projects to allow users to create an account, subscribe to your plans and get insight to their activity.

Learn More

Webhooks Documentation

Webhooks are used to notify your application any time an event happens on your account, for example, after a customer is subscribed.

Learn More


JS SDK Docs

  • Install

    Copy and paste the code below before the tag on every page of your site. Click here to view a demo.

    <script>var Pelcro = window.Pelcro || (window.Pelcro = {}); Pelcro.siteid = "ID";</script>
    <script async src="//cdn.pelcro.com/js/bab/min.js" type="text/javascript"></script>

    Copy and paste the button below anywhere you would like the user to display all plans from

    <a id="subscribe-button" class="btn btn-primary">Subscribe</a>

    Copy and paste the button below anywhere you would like the user to login from

    <a id="login-button" class="btn btn-primary">Login</a>
  • Configure

    We offer enterprise clients access to a staging environment where they can run tests. To configure a testing environment, set the options below in the SDK. Contact our sales team to learn more about a staging environment.

    <script>Pelcro.environment.domain = "https://staging.pelcro.com";</script>

    To trigger your own UI layer, you can set it using the UI env as shown below. Available to specific plans only.

    <script>Pelcro.environment.ui = "ui-react.bunlde.js";</script>
  • Core Modules

    All examples below are JS examples of the Pelcro object that is a global variable in the window object. The default Pelcro flow and UI uses all the SDK functions below automatically without any additional coding requirements by the publisher. The functions below can allow you create your own UI and flow layer by using the SDK functions below.

    Customer/User

    Pelcro.user.register(email, password, callback)

    Pelcro.user.login(email, password, callback)

    Pelcro.user.isAuthenticated()
    Card
    Pelcro.card.create($form, callback)
    Subscriptions

    Pelcro.subscription.create(cardToken, authToken, planId, callback)

    Pelcro.subscription.delete(subscriptionId, authToken, callback)

    Pelcro.subscription.isSubscribedToPlan(plan)
    Newsletter

    Pelcro.newsletter.create(email, callback)
    Address

    Pelcro.address.create(authToken, address, postal_code, city, region, country, callback)
    Paywall

    Pelcro.paywall.freeVisitsLeft()

    Pelcro.paywall.displayNewsletterPaywall()

    Pelcro.paywall.displayMeterPaywall()

    Pelcro.paywall.displayPaywall()

    Pelcro.paywall.getPaywallPlan()
  • Insight Module

    By default, page view events are tracked via Pelcro’s SDK. There is no need to trigger a custom event for every page view. Any interaction with our modals, meter or any view that Pelcro displays (if enabled) are automatically tracked and reported to your dashboard. If you are not using our default flows, then you might want to continue reading to learn how you can trigger custom events and properties.

    Events are captured programmatically using code. In this example, an event named “Button clicked” is triggered. You should plan out and prioritize all the events that are relevant and important to your business and make sure they are all tracked. You should always have to goals in mind, what do I need to track and what data do I need for machine learning.

    Pelcro.insight.track("Button clicked");

    In the example below, we are adding two custom properties to the event in the previous example. By default, we track the following properties to every event that is triggered, so there is no need to do that again.

    Pelcro.insight.track("Button clicked", {
        "name": Facebook like,
        "color": "Blue"
    });

    Default properties:This list is not exhaustive. We frequently add to this list any property we deem useful to our clients. You can view the up to date list in the segmentation report on your dashboard.

    • Country
    • Region
    • Scroll percentage at the time of the event
    • Time spent at the time of the event
    • UTM tags (source, medium, campaign, content, term)
    • Platform
    • Ad blocking status
    • Device
    • Referral source
    • Frequency (frequency of visitor on the site)
    • Device fingerprint