This is a port of igrigorik/ga-beacon to ASP.NET Core 2.1.
The beacon app serves either a one-pixel transparent GIF image or a visible icon (once their respective images are created). The <img />
tag with the pixel or icon can be placed to pages that cannot be tracked with ordinary Google Analytics JavaScript code. The beacon service will log hits to such pages instead.
The beacon service will check for the existence of the cid
cookie (used by Google Analytics) and will create one eventually.
The app consists of a Web API controller that accepts either:
- https://beacon-service/api/UA-00000-0?useReferer, or
- https://beacon-service/api/UA-00000-0/relative/path/to/tracked/page
The first option requires a Referer
request HTTP header to be present.
The above URLs can also be suffixed with the same switches as the original implementation:
pixel
gif
flat
flat-gif
Note: Currently, only the pixel
switch is supported. Other switches require their respective return images to be created for this repository. Feel free to contribute with your images!