Web Script
If you want to use Logspot in your HTML page which is not using NPM, you can use our logspot.js
script.
Add following script to your head section in your code:
Init
If you’ll add the script to your web page, it will automatically start tracking page views.
Init With Cookies Disabled
Track
Parameters:
name
- event name e.g. GroupCreateduserId
(optional) - unique user id which will link the event to a specific user. It can be integer, UUID or even an email.metadata
(optional) - you can attach a JSON object to your event.notify
(optional) - triggers mobile notifcation.message
(optional | max 255 chars) - messaged displayed in the app and in the notification.
Track Using CSS Classes
You can also track clicks on your website by using lgspt-
classname. All clicks will be automatically tracked.
The event name will be fetched from the classname.
Above click will result in the Sign Up
event.
Other Methods
You can use all methods in Web script which are available in JS SDK
Super Properties
You can define super properties which will be assigned to every event and pageview. It’s useful when you want to have some property on each event and you don’t want to set it manually everywhere for custom events.
?> Super properties will be stored in cookies for 30 days (if cookies are enabled)
How to Configure Super Properties for all Events Including the First Pageview?
!> The first pageview is sent when the script is loaded. If we call register
after when the script is loaded, the first pageview won’t have super properties.
You can define super properties which will be assigned to every event and pageview.
Define window.LogspotProps
in the script with properties you want to attach to all events/pageviews. Attach this script to <head>
section.