npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-drift

v2.1.2

Published

Vue.js plugin implementation of the Drift chat widget

Downloads

254

Readme

vue-drift

Vue.js plugin implementation of the Drift chat widget with 100% browser API compatability

Usage

Node-based environment

Install using npm:

npm install vue-drift

Add to index.js of your Vue application:

import Vue from 'vue'
import VueDrift from 'vue-drift'

Vue.use(VueDrift, {
  appId: 'YOUR_APP_ID',
})

Where appId is your application identifier provided by Drift

That's it! Enjoy!

Browser environment

It depends on your tooling, but the simplest way is to add this to your HTML page:

...
<div id="app"></div>
...
<script  src="https://unpkg.com/vue@latest/dist/vue.min.js"></script>

<script src="https://unpkg.com/vue-drift@latest/dist/vue-drift.window.min.js"></script>

<script>
  Vue.component('vue-drift', VueDrift);

  Vue.use(VueDrift, {
    appId: 'YOUR_APP_ID',
  })

  new Vue({
    el: '#app',
  })
</script>
...

Where appId is your application identifier provided by Drift

That's it! Enjoy!

Demo

Run in Terminal:

cd demo
npm install
echo 'DRIFT_APPID="YOUR_APP_ID"' > .env
npm run serve

Wait for a browser window to open

Advanced Usage

Disable in development mode

Add an optional parameter development when registering the component:

Vue.use(VueDrift, {
  appId: 'YOUR_APP_ID',
  development: true,
})

Change Configuration

Make this call anywhere in your app:

this.$drift.config({
  locale: 'SOME_LOCALE',
  backgroundColor: 'SOME_BACKGROUND_COLOR',
});

Identify Users

Add to App.vue of your Vue application:

<script>
export default {
  mounted() {
    this.$drift.identify('SOME_USER_ID', {
      name: 'SOME_USER_NAME',
      email: 'SOME_USER_EMAIL'
    })
  }
}
</script>

Remove User Identification

Make this call anywhere in your app:

this.$drift.reset();

Change Page

Make this call on route change in your app:

this.$drift.page();

Hide the Widget

Make this call anywhere in your app:

this.$drift.hide();

Show the Widget

Make this call anywhere in your app:

this.$drift.show();

Other browser API

Make this call anywhere in your app:

this.$drift.METHOD

where METHOD is any browser API method (see here)

License

MIT