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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@vinicius.diniz/datalayerpackage

v1.1.3

Published

![Dynamic JSON Badge](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fraw.githubusercontent.com%2Fmacielsds%2FdataLayerPackage%2Frefs%2Fheads%2Fmain%2Fpackage.json&query=version&prefix=v&label=npm) ![GitHub code size in bytes](https://img.shi

Downloads

133

Readme

dataLayerPackage

Dynamic JSON Badge GitHub code size in bytes

Instalação

  • Executar no terminal
npm install @vinicius.diniz/datalayerpackage

Como usar o pacote

Importar e usar normalmente conforme snippets abaixo.

Tudo está tipado e com uma documentação em JSDocs explicando o que cada propriedade faz, basta deixar o mouse parado sobre o nome da função.

Funções que diparam eventos do Data Layer

As funções possuem o padrão:

  • send + nome do evento em Camelcase + ToDataLayer()
import { sendMyEventAToDataLayer, sendMyEventBToDataLayer } from 'datalayerpackage'

sendMyEventAToDataLayer({ ... })
sendMyEventBToDataLayer({ ... })

Types de eventos e propriedades

import type { MyEventAProps, MyEventBProps } from 'datalayerpackage/types'

const myVariableA: MyEventAProps = {}
const myVariableB: MyEventBProps = {}

Hooks

Os hooks possuem o padrão de todo hook:

  • use + nome do hook em CamelCase
import { useMyHookA, useMyHookB } from 'datalayerpackage/hooks'

const { functionAa, functionAb, functionAc} = useMyHookA()
const { functionBa, functionBb, functionBc} = useMyHookB()

Implementação na loja

src/
├── datalayer/
│   ├── index.ts
│   ├── aEvent.ts
│   ├── bEvent.ts
│   └── cEvent.ts
├── components/index.ts
// src/datalayer/index.ts

// Apenas importa as funções feitas pra essa loja e faz o export
export { aEvent } from './aEvent'
export { bEvent } from './bEvent'
export { cEvent } from './cEvent'
// src/datalayer/aEvent.ts

// Importa as funções, types e hooks do pacote datalayerpackage
import { sendAEventToDataLayer } from 'datalayerpackage'

// Cria e exporta a função que trata os dados nessa loja
export function aEvent(props) {
	// Toda a lógica de tratar os dados do evento fica aqui
  // Quando nem todos os dados estão nas props, essa função pode ser async/await
  // No caso, fazendo request para pegar os dados faltantes
  const data = props.data

  // Também dispara aquele evento específico
  sendAEventToDataLayer(data)
}
// src/components/index.ts

// Importa a função de dentro src/datalayer/index.ts
import { aEvent } from 'src/datalayer'

export default function MyComponent(props) {
	// Pega os dados e passa direto por parâmetro pra função criada sem tratar nada
	// Deixar o mínimo de código aqui para não poluir o componente com lógica do datalayer
	const data = orderForm.data
	aEvent(data)
}