Mikinj Mistry
Mikinj Mistry

Reputation: 586

How to add transaction (eCommerce) in Google analytics using Node JS?

Currently, I am using googleapis npm modules for add transaction below is the link for the same.

Googleapis Nodemodules

I am not getting any way to add transaction for e-commerce tracking using Node JS.

I got a way to do this functionality using Javascript below is the link for the same.

Click here

It would be great if you will provide some sample code or Link for the same.

Upvotes: 1

Views: 729

Answers (1)

Max
Max

Reputation: 13334

You have 3 ways to send data to Google Analytics:

The code for sending a transaction using the aforementioned package would look as follows:

visitor
  .transaction({ti: "trans-12345", tr: 500, ts: 50, tt: 100, ta: "Partner 13"})
  .item({ip: 300, iq: 1, ic: "item-54321", in: "Item 54321", iv: "Blue"})
  .item({ip: 200, iq: 2, ic: "item-41325", in: "Item 41325", iv: "XXL"})
  .send()

Upvotes: 4

Related Questions