@meta8/prodmetrics
TypeScript icon, indicating that this package has built-in type declarations

1.8.0 • Public • Published

ProdMetrics

Install ProdMetrics

In your application, install our JavaScript SDK to identify your users and display surveys.

Replace YOUR-API-KEY with the unique API Key for your application. To find your API Key, sign in to your ProdMetrics account and navigate to Settings > Widget.

<!-- Install ProdMetrics SDK -->
<script type="text/javascript">
  (function(n,t,a,e){var i="prodmetrics";n[i]=n[i]||function(){n[i].apiKey=e;(n[i].q=n[i].q||[]).push(arguments)};
  var r=t.createElement("script");r.async=!0,r.src=a,r.onload=function(){n.ProdMetrics=n.ProdMetrics.init(e);
  (n[i].q||[]).forEach(function(q){n.ProdMetrics[q[0]](q[1])});delete n[i]};
  var c=t.getElementsByTagName("script")[0];c.parentNode.insertBefore(r,c)})
  (window, document, "https://unpkg.com/@meta8/prodmetrics@latest/dist/index.js", "YOUR-API-KEY");
</script>

Identifying users

Use the following code in your application wherever the user is logged in, and might be shown a survey. The following code is an example; you'll need to modify it to pass in your user's data.

<!-- Identify the current user of your appliaction -->
<script>
  prodmetrics('user', {
    externalId: user.id,
    email: user.email,
    name: user.name,
    firstSeenAt: new Date(user.created).toISOString()
  });
</script>

Documentation

Further documentation is available at https://docs.prodmetrics.io.

Package Sidebar

Install

npm i @meta8/prodmetrics

Weekly Downloads

7

Version

1.8.0

License

none

Unpacked Size

21.2 kB

Total Files

8

Last publish

Collaborators

  • thomas-meta8