Skip to content

Commit 6bfb68d

Browse files
committed
Add circle
1 parent 7569337 commit 6bfb68d

File tree

2 files changed

+138
-0
lines changed

2 files changed

+138
-0
lines changed

_docs/31_integrations/00_circle.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
title: Install Simple Analytics on Circle
3+
menu: Circle
4+
category: integrations
5+
permalink: /install-simple-analytics-on-circle
6+
last_modified_at: 2025-01-01
7+
---
8+
9+
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.
10+
11+
> 🚨 **Warning:** This is an advanced feature, and we recommend working with your developer to ensure the correct setup.
12+
13+
## Add conversion tracking code
14+
15+
To track successful payments in Simple Analytics when [creating](https://help.circle.so/p/payments/paywall-setup/set-up-a-paywall) or [editing](https://help.circle.so/p/payments/paywall-management/updating-a-paywall) your paywall:
16+
17+
1. In the paywall setup, navigate to the **Tracking** tab and add your code in the tracking code field.
18+
19+
1. To track a conversion event, use the following code that dynamically loads Simple Analytics and waits for it to be ready:
20+
21+
```html
22+
<script>
23+
(function () {
24+
// Load Simple Analytics script dynamically
25+
const script = document.createElement("script");
26+
script.setAttribute(
27+
"src",
28+
"https://scripts.simpleanalyticscdn.com/latest.js"
29+
);
30+
script.setAttribute("async", "true");
31+
32+
// Wait for script to load and then send event
33+
script.onload = function () {
34+
if (window.sa_event && window.sa_loaded) {
35+
sa_event("circle_payment_success");
36+
}
37+
};
38+
39+
document.head.appendChild(script);
40+
})();
41+
</script>
42+
```
43+
44+
1. To add dynamic variables from Circle (like payment amount or member email), click the **"Add variable {…}"** icon and select an option from the list. You can use the following variables:
45+
46+
- `{member_email}` - The email address of the member who made the payment
47+
- `{amount_paid}` - The amount paid
48+
- `{coupon_code}` - The coupon code used (if any)
49+
- `{paywall_internal_name}` - The internal name of the paywall
50+
- `{paywall_display_name}` - The display name of the paywall
51+
- `{paywall_trial_days}` - The number of trial days
52+
- `{paywall_price_amount}` - The price amount
53+
54+
Example with metadata:
55+
56+
```html
57+
<script>
58+
(function () {
59+
// Load Simple Analytics script dynamically
60+
const script = document.createElement("script");
61+
script.setAttribute(
62+
"src",
63+
"https://scripts.simpleanalyticscdn.com/latest.js"
64+
);
65+
script.setAttribute("async", "true");
66+
67+
// Wait for script to load and then send event with metadata
68+
script.onload = function () {
69+
if (window.sa_event && window.sa_loaded) {
70+
sa_event("circle_payment_success", {
71+
amount: "{amount_paid}",
72+
email: "{member_email}",
73+
paywall: "{paywall_display_name}",
74+
coupon: "{coupon_code}",
75+
});
76+
}
77+
};
78+
79+
document.head.appendChild(script);
80+
})();
81+
</script>
82+
```
83+
84+
1. Save changes to the paywall.
85+
86+
## Good to know
87+
88+
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.
89+
90+
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.
91+
92+
## Example: Complete conversion tracking
93+
94+
Here's a complete example that dynamically loads Simple Analytics and tracks the conversion with all available metadata:
95+
96+
```html
97+
<script>
98+
(function () {
99+
// Load Simple Analytics script dynamically
100+
const script = document.createElement("script");
101+
script.setAttribute(
102+
"src",
103+
"https://scripts.simpleanalyticscdn.com/latest.js"
104+
);
105+
script.setAttribute("async", "true");
106+
107+
// Wait for script to load and then send event with all metadata
108+
script.onload = function () {
109+
if (window.sa_event && window.sa_loaded) {
110+
sa_event("circle_payment_success", {
111+
amount: "{amount_paid}",
112+
email: "{member_email}",
113+
paywall_name: "{paywall_display_name}",
114+
paywall_internal: "{paywall_internal_name}",
115+
trial_days: "{paywall_trial_days}",
116+
price: "{paywall_price_amount}",
117+
coupon: "{coupon_code}",
118+
});
119+
}
120+
};
121+
122+
document.head.appendChild(script);
123+
})();
124+
</script>
125+
```
126+
127+
## Viewing your conversions
128+
129+
After setting up conversion tracking, you can view your payment events in Simple Analytics:
130+
131+
1. Go to your Simple Analytics dashboard
132+
2. Navigate to the [Events Explorer](/events-explorer) to see all conversion events
133+
3. Create a [Goal](/goals) to track conversion rates over time
134+
135+
If you encounter issues, don't hesitate to contact us via [our support channels](https://simpleanalytics.com/contact).

_docs/55_events/01_introduction.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ With events in Simple Analytics you can collect counts of certain events. Let's
1010

1111
If you want to get your hands dirty, you can collect events for all kinds of custom events. Like form submits, button clicks, and many more. We created a simple video showing how to collect events in Simple Analytics. [Here you go](https://www.youtube.com/watch?v=CCvdgTReqms)
1212

13+
For specific platforms, we have integration guides. For example, if you're using [Circle paywalls](/install-simple-analytics-on-circle), you can track successful payments as conversion events.
14+
1315
You can [download your events](/export-data), use them in the [Events Explorer](/events-explorer), and use them in [Goals](/goals).
1416

1517
<img class="border" src="https://assets.simpleanalytics.com/docs/events/events-explorer.png" alt="Overview of the Events Explorer in Simple Analytics" />
@@ -79,6 +81,7 @@ First, check if the events you need are part of our [automated events script](/a
7981
- [Link clicks](https://gist.github.com/adriaandotcom/aa00b4cdc85797a2f2ba715e82de85da#file-links-click-html)
8082
- [Form submits in Google Tag Manager](https://www.simpleanalytics.com/blog/how-to-track-form-submissions-using-google-tag-manager)
8183
- [Video events in Google Tag Manager](https://www.simpleanalytics.com/blog/video-tracking)
84+
- [Circle paywall conversions](/install-simple-analytics-on-circle) - Track successful payments
8285

8386
## Valid event names
8487

0 commit comments

Comments
 (0)