Adding JavaScript opt out to privacy section


(Anja Schulz) #1

Hallo team.

first i want to thank your for this gread piece of software.

I need some help to put a little javascript in my privacy scetion

 <a href="javascript:gaOptout()">Click here to opt-out of Google Analytics</a>

(Jeff Atwood) #2

You can’t put Javascript in posts, and the privacy policy is a post. You could add it to the footer, perhaps, in Admin, Customize.


(Kane York) #3

With a little finangling, you could probably make a conditional <button> appear if the Privacy Policy is being viewed that has an Ember action that calls gaOptout().

Is there a plugin-outlet for “above static pages”?


(Mittineague) #4

The ones I’ve found are

app/assets/javascripts/admin/templates

admin-hbs	*PLUGIN BROKEN
<ul> {{plugin-outlet "admin-menu" tagName="li"}}

app/assets/javascripts/discourse/templates/

composer-hbs	*HAVE WORKING PLUGIN
 {{plugin-outlet "composer-open"}}
 {{plugin-outlet "composer-fields"}}
 {{plugin-outlet "composer-fields-below"}}

discovery-hbs	*HAVE WORKING PLUGIN
<div> {{plugin-outlet "discovery-list-container-top"}}

modal/history-hbs	*PLUGIN BROKEN
 {{plugin-outlet "post-revisions"}}

post-hbs	*HAVE WORKING PLUGIN
 {{plugin-outlet "poster-avatar-bottom"}}
 {{plugin-outlet "topic-after-cooked"}}

user/preferences-hbs	*HAVE WORKING PLUGIN
<div> {{plugin-outlet "user_custom_preferences"}}

site-map-hbs	*HAVE WORKING PLUGIN
<ul> {{plugin-outlet "site-map-links"}}

topic-admin-menu-hbs
 {{plugin-outlet "topic-admin-menu-buttons"}}

components/topic-category-hbs
 {{plugin-outlet "topic-category"}}

topic-hbs	*HAVE WORKING PLUGIN
 {{plugin-outlet "topic-above-post-stream"}}
 {{plugin-outlet "edit-topic"}}
 {{plugin-outlet "topic-title"}}
 {{plugin-outlet "topic-above-suggested"}}

user/user-hbs	*HAVE WORKING PLUGIN
 {{plugin-outlet "user-profile-primary"}}
 {{plugin-outlet "user-profile-secondary"}}

(Kane York) #5

That would be a “no”, then. I think we could add a above-static-page outlet.

(nb: that PR does not conclude this support request)


(Anja Schulz) #6

Thanks for our your energy,

my first post was automaticly cuted. :slight_smile: I think cause the code in the post. The litte java script code from google stands right in the header. I only need i klickable link that calls the javascript funktion to set the cookie and make users can opt out google analytics. Might the outside static page way the right hint. I try this as next.

thank you guys for your input


(Mittineague) #7

The above-static plugin-outlet is located on FAQ, TOS and Privacy as shown here

Off-Topic
No big deal, but is it too late to change preferences.hbs from
user_custom_preferences to user-custom-preferences to be consistent with the others?


(Anja Schulz) #8

Thanks @,

i solved my clickable javascript with a external hosted privacy page. Docker and the plugins for discourse at the moment are like terra incognita to me. Maybe then “rebuild app” without shutting down the forum is possible i will give plugins a try.

have a nice weekend, its may and it’s not raining :wink: