
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
gem install amplitude-api
The following code snippet will immediately track an event to the Amplitude API.
# Configure your Amplitude API key
AmplitudeAPI.config.api_key = "abcdef123456"
event = AmplitudeAPI::Event.new({
user_id: "12345",
event_type: "clicked on home",
time: Time.now,
insert_id: 'f47ac10b-58cc-4372-a567-0e02b2c3d479',
event_properties: {
cause: "button",
arbitrary: "properties"
}
})
AmplitudeAPI.track(event)
You can track multiple events with a single call, with the only limit of the payload size imposed by Amplitude:
event_1 = AmplitudeAPI::Event.new(...)
event_2 = AmplitudeAPI::Event.new(...)
AmplitudeAPI.track(event_1, event_2)
events = [event_1, event_2]
AmplitudeAPI.track(*events)
In case you use an integer as the time, it is expected to be in seconds. Values in
the time field will be converted to milliseconds using ->(time) { time ? time.to_i * 1_000 : nil }
You can change this behaviour and use your custom formatter. For example, in case
you wanted to use milliseconds instead of seconds you could do this:
AmplitudeAPI.config.time_formatter = ->(time) { time ? time.to_i : nil },
You can speficy track options in the config. The options will be applied to all subsequent requests:
AmplitudeAPI.config.options = { min_id_length: 10 }
AmplitudeAPI.track(event)
The following code snippet will delete a user from amplitude
# Configure your Amplitude API key
AmplitudeAPI.config.api_key = "abcdef123456"
# Configure your Amplitude Secret Key
AmplitudeAPI.config.secret_key = "secretMcSecret"
AmplitudeAPI.delete(user_ids: ["12345"],
requester: "privacy@example.com"
)
Currently, we are using this in Rails and using ActiveJob to dispatch events asynchronously. I plan on moving background/asynchronous support into this gem.
user_id
presentI'd love to hear how you're using this. Please check out the issues.
FAQs
Unknown package
We found that amplitude-api 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.
Research
Security News
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.