Skip to content

Commit

Permalink
Merge pull request #696 from 3DStreet/add-posthog-events
Browse files Browse the repository at this point in the history
add posthog events for checkout
  • Loading branch information
kfarr authored Jul 12, 2024
2 parents 0efb20d + a2c37a3 commit 07dd879
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/editor/components/Main.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export default class Main extends Component {
this.setState({ isGeoModalOpened: true });
});
Events.on('openpaymentmodal', () => {
posthog.capture('payment_modal_opened');
this.setState({ isPaymentModalOpened: true });
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CheckMark32Icon, Loader } from '../../../icons';
import { Button } from '../../components/index.js';
import Modal from '../Modal.jsx';
import { functions } from '../../../services/firebase.js';
import posthog from 'posthog-js';

let stripePromise;
const getStripe = () => {
Expand All @@ -22,7 +23,12 @@ const PaymentModal = ({ isOpen, onClose }) => {
const { currentUser } = useAuthContext();
const [isLoading, setIsLoading] = useState(false);

if (currentUser?.isPro) {
posthog.capture('checkout_finished');
}

const startCheckout = async () => {
posthog.capture('start_checkout');
setIsLoading(true);
try {
const {
Expand Down

0 comments on commit 07dd879

Please sign in to comment.