Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
vue-hotjar
Advanced tools
This is a VueJs plugin that will allow you to easily add Hotjar to any Vue project. Some key benefits allow you to activate or deactivate tracking based on the environment and in some more advanced use cases you have access to $hj
. This is a global property that gives you access to the identify API and other functions to pass data to Hotjar.
npm install vue-hotjar
Start using it in your Vue application.
import Vue from 'vue'
import Hotjar from 'vue-hotjar'
Vue.use (Hotjar, {
id: 'XXXXXXX' // Hotjar Site ID
})
Your Hotjar Site ID is a required parameter. You can find this ID at insights.hotjar.com under tracking.
id: 'XXXXXXX'
If you would like to disable or enable tracking, pass in either true
or false
. It is advised to bind your Node ENV variable. This is an optional parameter and will default to true if not specified.
isProduction: true
This optional parameter does not need to be specified as it will default to the latest Hotjar Snippet version. Currently, it will default to version 6
.
snippetVersion: 6
import Vue from 'vue'
import Hotjar from 'vue-hotjar'
Vue.use (Hotjar, {
id: 'XXXXXXX',
isProduction: true,
snippetVersion: 6
})
In order to verify your installation in a production environment or whenever the isProduction
parameter is set to true
, you can simply navigate to the below URL. If the installation is successful you should see a notification appear on your website indicating that Hotjar is receiving data and your implementation is successful.
https://<YOUR-BASE-URL>/?hjVerifyInstall=<YOUR-SITE-ID>
Additionally you can verify the install by logging in to insights.hotjar.com and view the tracking status.
instead of accessing HotJar through window.hj
you can simply interact with the API via the a Vue global property $hj
.
Important To Note:
The global property $hj
will return false
if isProduction
is set to false
. Thus it is required to wrap your method in a simple if statement as per the examples below.
This functionality is only available if your Vue version is 2.x.x. For Vue Next users this is disabled for compatibility.
if (this.$hj) {
this.$hj('stateChange', '/your/url/here')
}
if (this.$hj) {
this.$hj('vpv', 'funnel-step-one')
}
if (this.$hj) {
this.$hj('identify', userId, {
email: 'hello@coffeeshop.com',
purchase_amount: 500,
ab_test: 'variant-A',
})
}
Vue ^2.0.0 is fully supported.
Vue ^3.0.0 is partially supported. TypeScript users will experience issues with typings due to the interface updates in Vue Next.
FAQs
Vue Hotjar plugin
The npm package vue-hotjar receives a total of 6,300 weekly downloads. As such, vue-hotjar popularity was classified as popular.
We found that vue-hotjar demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.