Comments (5)
One more alternative would be to keep universal-analytics
as a "raw", "close to the metal" library and send all the relevant ecommerce params via options
object (use standard validation logic, with extensions in a similar way to custom dimensions implementation) and build a new library to construct these params...
from universal-analytics.
@dominykas Hi Dominykas! We (https://github.com/breather) need enhanced ecommerce support too. Let me know how I can help!
from universal-analytics.
PR #29 is ready - it updates the acceptable params and also the validations, however it must be noted, that the lib DOES support all the EE params, except that without my PR it will give warnings if debug
flag is set to true.
I also published a gampee
module to help with constructing EE params (I'll update and document it further), but here's some sample code how to use it:
var gampee = require("gampee"),
ga = require("universal-analytics"),
_ = require("lodash");
var ecommerceParams = gampee([
{
// visitor saw two products in search
"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"
},
{
// visitor saw one product in highlights
"type": "impression",
"list": "highlights",
"products": [
{ "id": "pants", "name": "Pretty Pants" }
],
"currency": "EUR"
},
{
// and added one 5 of shirtM to cart
"type": "add",
"products": [
{ "id": "shirtM", "name": "Nice T-Shirt (M)", "position": 1, "quantity": 5 }
],
"currency": "EUR"
}
]);
var ua = ga("UA-00000000-0", "5bbb81ff-0757-44e0-8fcb-f263d982b95a", { debug: true });
ua.pageview(_.merge({
dp: "/",
cd20: "one",
cm20: "two"
}, ecommerceParams));
Result:
[universal-analytics] Enqueued pageview ({"dp":"/","cd20":"one","cm20":"two","il1nm":"search","cu":"EUR","il1pi1id":"shirtM","il1pi1nm":"Nice T-Shirt (M)","il1pi1ps":"1","il1pi2id":"shirtXL","il1pi2nm":"Nice T-Shirt (XL)","il1pi2ps":"2","il2nm":"highlights","il2pi1id":"pants","il2pi1nm":"Pretty Pants","pa":"add","pal":"search","pr1id":"shirtM","pr1nm":"Nice T-Shirt (M)","pr1ps":"1","pr1qt":"5","v":"1","tid":"UA-00000000-0","cid":"5bbb81ff-0757-44e0-8fcb-f263d982b95a","t":"pageview"})
from universal-analytics.
tried this sample code got :
[universal-analytics] Warning! Unsupported tracking parameter il1nm (search)
[universal-analytics] Warning! Unsupported tracking parameter il1pi1id (shirtM)
[universal-analytics] Warning! Unsupported tracking parameter il1pi1nm (Nice T-Shirt (M))
[universal-analytics] Warning! Unsupported tracking parameter il1pi1ps (1)
[universal-analytics] Warning! Unsupported tracking parameter il1pi2id (shirtXL)
[universal-analytics] Warning! Unsupported tracking parameter il1pi2nm (Nice T-Shirt (XL))
[universal-analytics] Warning! Unsupported tracking parameter il1pi2ps (2)
[universal-analytics] Enqueued pageview ({"dp":"/search?q=some+product","cd20":"one","cm20":"two","il1nm":"search","cu":"EUR","il1pi1id":"shirtM","il1pi1nm":"Nice T-Shirt (M)","il1pi1ps":"1","il1pi2id":"shirtXL","il1pi2nm":"Nice T-Shirt (XL)","il1pi2ps":"2","v":"1","tid":"UA-62992924-1","cid":"5bbb81ff-0757-44e0-8fcb-f263d982b95a","t":"pageview"})
and no impression under conversation -> ecommerce -> overview
from universal-analytics.
The warnings are because the PR is still not merged.
As for impressions - just to double check - you know there's a delay until the stats display, right? Did the "add to cart" appear?
from universal-analytics.
Related Issues (20)
- Ad tracking? HOT 1
- Vulnerability in "request" sub-package HOT 6
- Typescript support? HOT 1
- How to mark event as "User" (raising login event won't mark thing as user) HOT 1
- Custom dimensions with E-commerce tracking HOT 1
- GA + UA HOT 2
- 'Cannot read properties of undefined (reading '_readableState')' error occurred after 0.5.0 update HOT 2
- Payload data sent as object not working HOT 2
- IP not being assigned when using a proxy HOT 2
- Requests are being ignored by GA HOT 5
- Support for Event Values as String HOT 4
- Analytics no longer sent since upgrade from 0.4.23
- Transaction is not reflected being reflected on GA dashboard HOT 2
- Transactions are not being reflected on GA dashboard HOT 3
- Custom dimension and Event data not matching
- Universal Analytics Deprecation HOT 3
- Active users count differently with and without `strictCidFormat`
- Yarn problem with WebpackEncore
- Separate License file?
- Using HTTP proxy
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from universal-analytics.