Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
enhancement: remove GA cookie
  • Loading branch information
goenning committed May 13, 2021
1 parent 6805e93 commit 1cda857
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 29 deletions.
1 change: 1 addition & 0 deletions app/pkg/web/renderer.go
Expand Up @@ -214,6 +214,7 @@ func (r *Renderer) Render(w io.Writer, statusCode int, templateName string, prop
}

public["contextID"] = ctx.ContextID()
public["sessionID"] = ctx.SessionID()
public["tenant"] = tenant
public["props"] = props.Data
public["settings"] = &Map{
Expand Down
7 changes: 4 additions & 3 deletions app/pkg/web/testdata/basic.html
Expand Up @@ -33,15 +33,16 @@ <h2 class="text-display2">Please enable JavaScript</h2>
</noscript>




<div id="root"></div><div id="root-modal"></div><div id="root-toastify"></div>

<script id="server-data" type="application/json">

{"contextID":"CONTEXT_ID","props":{},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}
{"contextID":"CONTEXT_ID","props":{},"sessionID":"","settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>






Expand Down
7 changes: 4 additions & 3 deletions app/pkg/web/testdata/canonical.html
Expand Up @@ -35,15 +35,16 @@ <h2 class="text-display2">Please enable JavaScript</h2>
</noscript>




<div id="root"></div><div id="root-modal"></div><div id="root-toastify"></div>

<script id="server-data" type="application/json">

{"contextID":"CONTEXT_ID","props":{},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}
{"contextID":"CONTEXT_ID","props":{},"sessionID":"","settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>






Expand Down
7 changes: 4 additions & 3 deletions app/pkg/web/testdata/chunk.html
Expand Up @@ -40,15 +40,16 @@ <h2 class="text-display2">Please enable JavaScript</h2>
</noscript>




<div id="root"></div><div id="root-modal"></div><div id="root-toastify"></div>

<script id="server-data" type="application/json">

{"contextID":"CONTEXT_ID","props":{},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}
{"contextID":"CONTEXT_ID","props":{},"sessionID":"","settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>






Expand Down
7 changes: 4 additions & 3 deletions app/pkg/web/testdata/home.html
Expand Up @@ -33,15 +33,16 @@ <h2 class="text-display2">Please enable JavaScript</h2>
</noscript>




<div id="root"></div><div id="root-modal"></div><div id="root-toastify"></div>

<script id="server-data" type="application/json">

{"contextID":"CONTEXT_ID","description":"My Page Description","props":{"countPerStatus":{},"posts":[],"tags":[]},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider"}
{"contextID":"CONTEXT_ID","description":"My Page Description","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider"}

</script>






Expand Down
5 changes: 3 additions & 2 deletions app/pkg/web/testdata/home_ssr.html
Expand Up @@ -27,15 +27,16 @@





<div id="root"><div class="c-dev-banner">DEV</div><div id="c-header"><div class="c-menu shadow p-2 w-full flex flex flex-x flex--spacing-1 flex-items-center"><div class="container"><div class="flex flex flex-x flex--spacing-1 flex-items-center justify-between"><a href="/" class="flex flex-x flex-items-center flex--spacing-2 h-8"><h1 class="text-title"></h1></a><a href="#" class="uppercase text-sm">Sign in</a></div></div></div></div><div id="p-home" class="page container"><div class="p-home__welcome-col"><div class="flex flex flex-y flex--spacing-2"><div class="c-markdown "><p>We&#39;d love to hear what you&#39;re thinking about. </p>
<p>What can we do better? This is the place for you to vote, discuss and share ideas.</p></div><form autoComplete="off" class="c-form"><div class="c-form-field"><div class="relative flex flex flex-x"><input type="text" class="c-input" id="input-title" tabindex="-1" maxLength="100" value="" placeholder="Enter your suggestion here..."/></div></div></form><div class="c-powered sm:hidden md:hidden lg:block"><a rel="noopener" href="https://getfider.com" target="_blank">Powered by Fider</a></div></div></div><div class="p-home__posts-col"><div class="text-center"><img style="height:120px" height="120" class="mt-6 mb-2" src="data:image/svg+xml;base64,PHN2ZyBpZD0iYjIxNjEzYzktMmJmMC00ZDM3LWJlZjAtM2IxOTNkMzRmYzVkIiBkYXRhLW5hbWU9IkxheWVyIDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMD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TUsMCwwLDEsODAxLjgxODM2LDMxOC4wODY5MVoiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yNzYuMTgxODcgLTEzMy45MTMwOSkiIGZpbGw9IiM0MzM4Y2EiLz48Y2lyY2xlIGN4PSI0MzMuNjM2MjYiIGN5PSIxMDUuMTczODMiIHI9IjIwIiBmaWxsPSIjNDMzOGNhIi8+PGNpcmNsZSBjeD0iNDMzLjYzNjI2IiBjeT0iMTA1LjE3MzgzIiByPSIxMi4xODE4NyIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg=="/><p class="text-muted">No posts have been created yet.</p></div><div class="c-powered lg:hidden xl:hidden mt-8"><a rel="noopener" href="https://getfider.com" target="_blank">Powered by Fider</a></div></div></div></div>


<script id="server-data" type="application/json">

</script>






Expand Down
7 changes: 4 additions & 3 deletions app/pkg/web/testdata/oauth.html
Expand Up @@ -33,15 +33,16 @@ <h2 class="text-display2">Please enable JavaScript</h2>
</noscript>




<div id="root"></div><div id="root-modal"></div><div id="root-toastify"></div>

<script id="server-data" type="application/json">

{"contextID":"CONTEXT_ID","props":{},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[{"provider":"google","displayName":"Google","clientID":"1234","url":"https://demo.test.fider.io:3000/oauth/google","callbackURL":"https://demo.test.fider.io:3000/oauth/google/callback","logoBlobKey":"google.png","isCustomProvider":false,"isEnabled":true}],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}
{"contextID":"CONTEXT_ID","props":{},"sessionID":"","settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[{"provider":"google","displayName":"Google","clientID":"1234","url":"https://demo.test.fider.io:3000/oauth/google","callbackURL":"https://demo.test.fider.io:3000/oauth/google/callback","logoBlobKey":"google.png","isCustomProvider":false,"isEnabled":true}],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"Fider"}

</script>






Expand Down
7 changes: 4 additions & 3 deletions app/pkg/web/testdata/tenant.html
Expand Up @@ -33,15 +33,16 @@ <h2 class="text-display2">Please enable JavaScript</h2>
</noscript>




<div id="root"></div><div id="root-modal"></div><div id="root-toastify"></div>

<script id="server-data" type="application/json">

{"contextID":"CONTEXT_ID","props":{},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"isPrivate":false,"logoBlobKey":""},"title":"Game of Thrones"}
{"contextID":"CONTEXT_ID","props":{},"sessionID":"","settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"isPrivate":false,"logoBlobKey":""},"title":"Game of Thrones"}

</script>






Expand Down
7 changes: 4 additions & 3 deletions app/pkg/web/testdata/user.html
Expand Up @@ -33,15 +33,16 @@ <h2 class="text-display2">Please enable JavaScript</h2>
</noscript>




<div id="root"></div><div id="root-modal"></div><div id="root-toastify"></div>

<script id="server-data" type="application/json">

{"contextID":"CONTEXT_ID","description":"My Page Description","props":{},"settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider","user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/avatars/gravatar/5/Jon%20Snow","email":"jon.snow@got.com","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}
{"contextID":"CONTEXT_ID","description":"My Page Description","props":{},"sessionID":"","settings":{"baseURL":"https://demo.test.fider.io:3000","buildTime":"","compiler":"","domain":"","environment":"","globalAssetsURL":"https://demo.test.fider.io:3000","googleAnalytics":"","hasLegal":false,"mode":"","oauth":[],"tenantAssetsURL":"https://demo.test.fider.io:3000","version":""},"tenant":null,"title":"My Page Title · Fider","user":{"avatarBlobKey":"","avatarType":"gravatar","avatarURL":"https://demo.test.fider.io:3000/avatars/gravatar/5/Jon%20Snow","email":"jon.snow@got.com","id":5,"isAdministrator":true,"isCollaborator":true,"name":"Jon Snow","role":"administrator","status":"active"}}

</script>






Expand Down
17 changes: 11 additions & 6 deletions views/base.html
Expand Up @@ -26,24 +26,29 @@
<body>
{{block "noscript" .}}{{end}}

{{template "content" .}}

<script id="server-data" type="application/json">
{{template "server-data" .}}
</script>

{{ if ne .public.settings.googleAnalytics "" }}
<script type="text/javascript" nonce="{{ .public.contextID }}">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', '{{ .public.settings.googleAnalytics }}', 'auto');
ga('create', '{{ .public.settings.googleAnalytics }}', {
'storage': 'none',
'clientId': '{{ .public.sessionID }}'
});
ga('set', 'anonymizeIp', true);
{{ if .public.tenant }}ga('set', 'dimension1', '{{ .public.tenant.Subdomain }}');{{ end }}
ga('send', 'pageview');
</script>
{{ end }}

{{template "content" .}}

<script id="server-data" type="application/json">
{{template "server-data" .}}
</script>
{{template "end-of-body" .}}
{{ if .public.tenant }}
{{ if .public.tenant.CustomCSS }}
Expand Down

0 comments on commit 1cda857

Please sign in to comment.