Aaron Henderson
Aaron Henderson

Reputation: 75

Using analytics.js and the measurement protocol together

I'm currently using Universal analytics.js with the enhanced ecommerce plugin in my store checkout.

When reaching the end of the checkout, I want to send the transaction data client side over the measurement protocol.

I'm wondering if this is at all possible to link up with the customers session created from analytics.js and if so, how?

Thanks in advance for any help

Upvotes: 3

Views: 1241

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 116918

Its probably possible but it will be hard to do it IMO.

Session control is based upon the cid (and uid if you are also sending that) sent with the request.

For you to be able to send these after the fact you are going to have to find a way of saving the CID analytics.js used This might help Cookies and User Identification. if you have the cid and send a request to the measurement protocol using that client id it should be considered the same user / session.

I have never tried this but in theory it should work. If you do get it to work I would love to know :)

You might also consider adding some kind of custom dimension that would allow you to link the two requests.

If you are however using session control once you have sent session end there is probably nothing you can do. The session has ended I don't think you will be able to add anymore information to it.

Upvotes: 4

Related Questions