useCroct
Learn how to access the SDK instance.
This composable gets the instance of the SDK initialized by the createCroct plugin, providing access to the Plug API.
Signature
This composable has the following signature:
function useCroct(): Plug;The return is the Plug instance.
Example
Here is an example of how to use this composable:
components/SignupButton.vue
JavaScript
123456789101112131415
<script setup>import {useCroct} from '@croct/plug-vue';
const croct = useCroct();
function onClick() { croct.track('goalCompleted', { goalId: 'ctaClicked', });}</script>
<template> <a href="/signup" @click="onClick">Sign up</a></template>