useCroct

Learn how to access the SDK instance.

This composable returns the Croct Plug instance, giving you access to the full Plug API.

Signature

This composable has the following signature:

function useCroct(): Plug;

Example

Here is an example of how to use this composable to track a goal event:

components/HomeHero.vue
12345678910111213
<script setup>const croct = useCroct();
function onCtaClick() {  croct.track('goalCompleted', {    goalId: 'ctaClicked',  });}</script>
<template>  <a href="/signup" @click="onCtaClick">Sign up for free</a></template>