Show HN: Boost mailing list signups with Safe Harbor

It's written as a blog post but it's really a Show HN, as you'll see.

https://ramachandr.in/2018/05/19/the-1-reason-why-no-one-sig...

6 points | by saimiam 2160 days ago

1 comments

  • timvdalen 2160 days ago
    Repo: https://github.com/saiscode/safe-harbor

    Do you have an explanation of the source[1] somewhere? I don't really understand why you'd need window.performance or why this requires PubNub (Which also doesn't seem to be loaded as a dependency).

    [1]: https://github.com/saiscode/safe-harbor/blob/master/assets/j...

    • saimiam 2160 days ago
      I had a couple of constraints which made me go with a tool like Pubnub.

      1. I wanted to release this to the public.

      2. I wanted to have the option of adding support for future socialmedia referrers without releasing new code.

      To solve for 2, I chose to create a central server which pushes out up-to-date styling instructions on request. The alternative would have been to create a static css file which runs into issues of caching.

      To solve for 1, I chose messaging (PubNub) instead of http to (a) avoid dealing with CORS because I wasn't sure I'd get it right because my infra is selfhosted (b) learn and use messaging in a live app.

      > window.performance

      That flag is to check if a page is being reloaded or not. Since the referrer http header (from where javascript presumably gets its value) persists across reloads, to keep track of true referrals vs reloads, I check for the value of this flag.

    • dylz 2160 days ago
      window.performance.navigation.type = 1 is a reload, = 0 is a navigate. It is checking if the page loaded via clicking a link or otherwise, at least.