spinners
spinners

Reputation: 2679

Amp analytics encodeURIComponent for tracking pixel

I have an amp page that I would like to track with our analytics tool.

The non amp implementation for the tracking pixel is something like this e.g.

var payload = {a:1,b2}
var img = document.createElement("img");

img.src = "http://www.examplepixel.com?data=" + encodeURIComponent(payload)

I have read the documentation on amp-pixel and amp-analytics I see no way to perform the encoding.

How can I do this?

Upvotes: 0

Views: 94

Answers (1)

Sebastian Benz
Sebastian Benz

Reputation: 4288

The amp way is using amp-pixel:

<amp-pixel src="http://www.examplepixel.com?data=%7Ba%3A1%2Cb%3A%202%7D"
layout="nodisplay"></amp-pixel>

Upvotes: 0

Related Questions