Embed Widget Documentation

Add a beautiful pricing widget to your website and let customers subscribe directly from your site.

1Quick Start

The fastest way to add Trickl pricing to your website. Just copy and paste this code into your HTML:

<!-- Trickl Pricing Widget -->
<div id="trickl-pricing"></div>
<script
  src="https://trickl.app/embed.js"
  data-provider="YOUR_PROVIDER_CODE"
  data-height="600"
></script>

Replace YOUR_PROVIDER_CODE with your unique provider code found in your dashboard.

2Installation Methods

Script (Recommended)

The script embed automatically handles initialization and is the easiest way to add the widget.

<div id="trickl-pricing"></div>
<script
  src="https://trickl.app/embed.js"
  data-provider="YOUR_PROVIDER_CODE"
  data-height="600"
></script>

Available Attributes

AttributeRequiredDefaultDescription
data-providerYes-Your unique provider code
data-heightNo600Widget height in pixels
data-widthNo100%Widget width (px or %)
data-containerNo#trickl-pricingCustom container selector

iFrame

If you prefer more control or your platform doesn't support external scripts:

<iframe
  src="https://trickl.app/embed/YOUR_PROVIDER_CODE"
  width="100%"
  height="600"
  frameborder="0"
  style="border: none; overflow: hidden;"
  title="Pricing"
></iframe>

JavaScript API

For programmatic control over the widget:

<div id="pricing-widget"></div>

<script src="https://trickl.app/embed.js"></script>
<script>
  document.addEventListener('DOMContentLoaded', function() {
    const widget = Trickl.init({
      container: '#pricing-widget',
      providerCode: 'YOUR_PROVIDER_CODE',
      height: '600px',
      width: '100%'
    });

    // To remove the widget later:
    // widget.destroy();
  });
</script>

3Framework Examples

React

import { useEffect, useRef } from 'react';

function TricklPricing({ providerCode }) {
  const containerRef = useRef(null);

  useEffect(() => {
    const script = document.createElement('script');
    script.src = 'https://trickl.app/embed.js';
    script.async = true;

    script.onload = () => {
      if (window.Trickl && containerRef.current) {
        window.Trickl.init({
          container: containerRef.current,
          providerCode: providerCode,
          height: '600px'
        });
      }
    };

    document.body.appendChild(script);
    return () => document.body.removeChild(script);
  }, [providerCode]);

  return <div ref={containerRef} />;
}

// Usage: <TricklPricing providerCode="ABC123XY" />

Next.js

'use client';

import { useEffect, useRef } from 'react';
import Script from 'next/script';

export default function TricklPricing({ providerCode }) {
  const containerRef = useRef(null);
  const widgetRef = useRef(null);

  useEffect(() => {
    return () => {
      if (widgetRef.current?.destroy) {
        widgetRef.current.destroy();
      }
    };
  }, []);

  const handleScriptLoad = () => {
    if (window.Trickl && containerRef.current) {
      widgetRef.current = window.Trickl.init({
        container: containerRef.current,
        providerCode: providerCode,
        height: '600px'
      });
    }
  };

  return (
    <>
      <div ref={containerRef} />
      <Script
        src="https://trickl.app/embed.js"
        onLoad={handleScriptLoad}
        strategy="lazyOnload"
      />
    </>
  );
}

Vue.js

<template>
  <div ref="pricingContainer"></div>
</template>

<script>
export default {
  props: {
    providerCode: { type: String, required: true }
  },
  mounted() {
    const script = document.createElement('script');
    script.src = 'https://trickl.app/embed.js';
    script.async = true;

    script.onload = () => {
      if (window.Trickl) {
        window.Trickl.init({
          container: this.$refs.pricingContainer,
          providerCode: this.providerCode,
          height: '600px'
        });
      }
    };

    document.body.appendChild(script);
  }
}
</script>

4CMS Platforms

WordPress

Add a Custom HTML block and paste the embed code.

Webflow

Add an Embed element and paste the code.

Squarespace

Add a Code Block and paste the embed code.

Wix

Add an Embed HTML element and paste the code.

5Troubleshooting

Widget Not Showing

  • Check that your provider code is correct
  • Ensure the container div exists before the script loads
  • Open browser DevTools (F12) and check for errors

Content Security Policy (CSP)

If you have a strict CSP, add these directives:

frame-src https://trickl.app; script-src https://trickl.app;

6Floating Support Button

One line puts a “Support me” button in the corner of every page. No container and no template editing: paste it into your site's footer or custom-code setting and it appears site-wide. Fans pick one-time or monthly and an amount, then finish on Trickl in a new tab.

<script
  src="https://www.trickl.app/support-widget.js"
  data-provider="YOUR_PROVIDER_CODE"
  async
></script>

How fans pay

Nothing is charged up front. Trickl collects support as micro-payments from the fan's everyday spending — round-ups and Trickl Down — and every payment goes straight to you.

  • One-time — the amount arrives in small pieces as the fan spends over the following weeks.
  • Monthly — a subscription to you at the fan's chosen amount, collected through each month. It shows up with your other subscribers.

Options

AttributeWhat it does
data-providerRequired. Your provider code from the dashboard.
data-labelButton text. Default “Support me”, up to 40 characters.
data-colorButton colour as #rrggbb. Text colour is picked for contrast.
data-positionright (default) or left.

Your site's own styles don't change the button, and the button doesn't change your site. Pasting the script twice still shows one button. To open the panel from your own link or button, call TricklSupport.open(); TricklSupport.close() and TricklSupport.destroy() are also available.

Sites with a strict Content-Security-Policy

A site that restricts third-party scripts or frames will block the button (or show it but not the panel) until Trickl is allowed. This is true of every embeddable support button. Add Trickl to both directives:

script-src https://trickl.app https://www.trickl.app; frame-src https://trickl.app https://www.trickl.app;

If the panel can't load, the button offers a link to finish on Trickl in a new tab instead. Most hosted builders (Wix, Squarespace, WordPress.com) don't set a CSP.

Need Help?

Our support team is here to help you get set up.

Contact Support