Install Simple Analytics on Circle
You can track conversions and successful payments in Simple Analytics when using Circle paywalls. Circle allows you to add custom JavaScript code to your paywall thank you page, which is perfect for tracking conversion events.
Warning: This is an advanced feature, and we recommend working with your developer to ensure the correct setup.
Add conversion tracking code
To track successful payments in Simple Analytics when creating or editing your paywall:
-
In the paywall setup, navigate to the Tracking tab and add your code in the tracking code field.
-
To track a conversion event, use the following code that dynamically loads Simple Analytics and waits for it to be ready:
<script> (function () { // Load Simple Analytics script dynamically const script = document.createElement("script"); script.setAttribute( "src", "https://scripts.simpleanalyticscdn.com/latest.js" ); script.setAttribute("async", "true"); // Wait for script to load and then send event script.onload = function () { if (window.sa_event && window.sa_loaded) { sa_event("circle_payment_success"); } }; document.head.appendChild(script); })(); </script> -
To add dynamic variables from Circle (like the payment amount or the paywall name), click the “Add variable {…}” icon and select an option from the list. You can use the following variables:
{amount_paid}- The amount paid{coupon_code}- The coupon code used (if any){paywall_internal_name}- The internal name of the paywall{paywall_display_name}- The display name of the paywall{paywall_trial_days}- The number of trial days{paywall_price_amount}- The price amount
Don’t send
{member_email}or other personal data as metadata. We don’t allow personal data in events and metadata.Example with metadata:
<script> (function () { // Load Simple Analytics script dynamically const script = document.createElement("script"); script.setAttribute( "src", "https://scripts.simpleanalyticscdn.com/latest.js" ); script.setAttribute("async", "true"); // Wait for script to load and then send event with metadata script.onload = function () { if (window.sa_event && window.sa_loaded) { sa_event("circle_payment_success", { amount: "{amount_paid}", paywall: "{paywall_display_name}", coupon: "{coupon_code}", }); } }; document.head.appendChild(script); })(); </script> -
Save changes to the paywall.
Good to know
The <script> tags are required and must wrap your code. Be sure your code is valid and has no runtime issues before you save your paywall.
The code dynamically loads the Simple Analytics script and uses the onload event to wait for it to be ready before sending the event. This ensures the event is properly tracked once the script has loaded and initialized.
Example: Complete conversion tracking
Here’s a complete example that dynamically loads Simple Analytics and tracks the conversion with metadata:
<script>
(function () {
// Load Simple Analytics script dynamically
const script = document.createElement("script");
script.setAttribute(
"src",
"https://scripts.simpleanalyticscdn.com/latest.js"
);
script.setAttribute("async", "true");
// Wait for script to load and then send event with metadata
script.onload = function () {
if (window.sa_event && window.sa_loaded) {
sa_event("circle_payment_success", {
amount: "{amount_paid}",
paywall_name: "{paywall_display_name}",
paywall_internal: "{paywall_internal_name}",
trial_days: "{paywall_trial_days}",
price: "{paywall_price_amount}",
coupon: "{coupon_code}",
});
}
};
document.head.appendChild(script);
})();
</script>
Viewing your conversions
After setting up conversion tracking, you can view your payment events in Simple Analytics:
- Go to your Simple Analytics dashboard
- Navigate to the Events Explorer to see all conversion events
- Create a Goal to track conversion rates over time
If you encounter issues, don’t hesitate to contact us via our support channels.