singlelink-co / Singlelink

The open-source Linktree alternative.
https://singlelink.co
GNU General Public License v3.0
559 stars 117 forks source link

šŸ› Bug: Singlelink does not correctly report Plausible analytics #93

Closed ArsalaBangash closed 3 years ago

ArsalaBangash commented 3 years ago

Expected Behavior šŸ§­

I expected Plausible Analytics to work with my current single-link setup for http://link.grey.software

Current Behavior šŸ”

When I load up the page, an event is fired to plausible with the following request and response headers:

Request

POST /api/event HTTP/2
Host: plausible.io
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:85.0) Gecko/20100101 Firefox/85.0
Accept: */*
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Content-Type: text/plain
Content-Length: 113
Origin: https://app.singlelink.co
Connection: keep-alive
Referer: https://app.singlelink.co/
Sec-GPC: 1

Response

HTTP/2 202 Accepted
access-control-allow-credentials: true
access-control-allow-origin: *
access-control-expose-headers: 
cache-control: max-age=0, private, must-revalidate
content-length: 0
date: Tue, 02 Feb 2021 07:42:33 GMT
server: Netlify
x-request-id: Fl_ebaN6fIPMnowHD5lh
age: 1
x-nf-request-id: a7a30d20-4877-46fa-b599-01bf544b2701-10554649
X-Firefox-Spdy: h2

Steps to Reproduce šŸ”¢

  1. I added link.grey.software to the singlelink custom domain field
image
  1. I added a masked domain redirect
image
  1. I registered link.grey.software on plausible
image
  1. I added the plausible script to my singlelink custom HTML tag
image

Acceptence Criteria for Fix āœ…

\ - [ ] When I set Singlelink to point to a particular domain registered on plausible, I should receive plausible analytics ### Possible Solution šŸ› ļø

At first, I thought the issue was happening because the plausible script wasn't in the head tag, but now I feel like the issue may be in the request headers. It's showing the origin and referer as app.singlelink.co

Implementation Details šŸ§°

Haven't had the time to research beyond the fact that the custom HTML wasn't in the head tag.

Additional details ā„¹ļø

I envision the analytics tab having a field for script tags that could go in the Head. I think the solution to this issue should inform some great documentation :)

jimmybisenius commented 3 years ago

Believe this is related to issue 94 (https://github.com/Neutron-Creative/Singlelink/issues/94). Will update you closely.

ArsalaBangash commented 3 years ago
image

šŸ”„ Plausible now works!!!

jimmybisenius commented 3 years ago

I was going to ask you later today @ArsalaBangash !

Glad our newest update got this resolved for you :) Don't hesitate to reach out if there's anything else we can help with!!