Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
gampee
Advanced tools
Readme
Converts and validates humanly understandable Enhanced E-commerce params into Measurement Protocol. Friends with universal-analytics.
var gampee = require("gampee"),
ga = require("universal-analytics");
var ecommerceParams = gampee({
"type": "impression",
"list": "search",
"products": [
{ "id": "shirtM", "name": "Nice T-Shirt (M)", "position": 1 },
{ "id": "shirtXL", "name": "Nice T-Shirt (XL)", "position": 2 }
],
"currency": "EUR"
});
assert.equal(ecommerceParams, {
"il0nm": "search",
"il0pi0id": "shirtM",
"il0pi0nm": "Nice T-Shirt (M)",
"il0pi0ps": 1,
"il0pi1id": "shirtXL",
"il0pi1nm": "Nice T-Shirt (XL)",
"il0pi1ps": 2,
"cu": "EUR"
});
// send together with a pageview
var ua = ga("UA-00000000-0", "5bbb81ff-0757-44e0-8fcb-f263d982b95a", { debug: true });
ua.pageview(_.merge({ dp: "/search?q=some+product", cd20: "one", cm20: "two" }, ecommerceParams));
promo
and promo_click
gampee( EcommerceAction action, [function onValidationError] )
gampee( EcommerceAction[] actionList, [function onValidationError] )
EcommerceAction
is an object with a required type
property. type
can be either an impression
or one of ecommerce
product actions:
click
, detail
, add
, remove
, purchase
, refund
, checkout
, checkout_option
. Each data item should also
have a list of Product[] products
.
You can send multiple items with impressions (e.g. when there are multiple lists of products on the page), but only one product action with each analytics hit (event, pageview, etc).
If onValidationError
is passed in (default: void
), it will be called with details of every validation warning, e.g.
gampee( myParams, console.warn.bind(console));
See the table below for required/optional/allowed properties of EcommerceAction
and Product
.
Note that although documentation says all hit types are allowed, the product information will be discarded if sent with
transaction
hit type (and probably some others). We have only tried testing full information with pageview
and
event
hit types.
This roughly mirrors the ecommerce.js API.
type | |||||
---|---|---|---|---|---|
impression | click , detail | add , remove | purchase , refund | checkout , checkout_option | |
currency
Currency Code | opt | opt | opt | opt | opt |
list
Product Action List, Product Impression List Name | opt | opt | opt | ||
id
Transaction ID | req | ||||
affiliation
Transaction Affiliation | opt | ||||
revenue
Transaction Revenue | opt | ||||
tax
Transaction Tax | opt | ||||
shipping
Transaction Shipping | opt | ||||
coupon
Coupon Code | opt | ||||
step
Checkout Step | opt | ||||
option
Checkout Step Option | opt | ||||
products[] | |||||
id
Product SKU | req | req | req | req | req |
name
Product Name | req | req | req | req | req |
brand
Product Brand | opt | opt | opt | opt | opt |
category
Product Category | opt | opt | opt | opt | opt |
variant
Product Variant | opt | opt | opt | opt | opt |
price
Product Price | opt | opt | opt | opt | opt |
position
Product Position | opt | opt | |||
coupon
Product Coupon Code | opt | opt | opt | opt | |
quantity
Product Quantity | opt | opt | opt |
FAQs
Helps out with Google Analytics Measurement Protocol Enhanced Ecommerce params
The npm package gampee receives a total of 320 weekly downloads. As such, gampee popularity was classified as not popular.
We found that gampee demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.