Skip to main content
Version: 3.2.1

NuxtJS

Initialize an empty Nuxt project

# yarn
yarn create nuxt-app <project-name>

# npx
npx create-nuxt-app <project-name>

Add Integry SDK

# yarn
yarn add @integry/sdk

# npm
npm i @integry/sdk -S

Add a Vue component

# cd into project root dir
cd <project-dir>

# create a new component
touch components/SDKContainer.vue

Add SDK code

components/SDKContainer.vue
<template>
<div id="my-sdk-container" />
</template>

<script lang="ts">
import { IntegryJS, Helpers } from '@integry/sdk';

export default {
async mounted() {
// Fill these in from the SDK deployments page
const appKey = '<APP_KEY>';
const appSecret = '<APP_SECRET>';
const userId = '<USER_ID>';
const deploymentId = '<DEPLOY_ID>';

// This is intended for use in testing only!
// Please refer to sdk.integry.io for more details
const hash = await Helpers.getAuthHash(userId, appSecret);

const integryHandle = new IntegryJS({
appKey,
hash,
userId,
deploymentId,
});

integryHandle.init({
containerId: 'my-sdk-container',
renderMode: IntegryJS.RenderModes.INLINE,
});
},
};
</script>

Include the component in your page

components/Tutorial.vue
<template>
...
<SDKContainer />
</template>

Now, run your Nuxt app.

tip

A full example is hosted here on Github.