Skip to content

Commit 4df738d

Browse files
authored
Merge pull request #2347 from broadinstitute/jb-appcues-removal
Removing all AppCues integration (SCP-6095)
2 parents 08467ab + e509327 commit 4df738d

File tree

3 files changed

+5
-60
lines changed

3 files changed

+5
-60
lines changed

app/javascript/lib/metrics-api.js

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@ export function logClick(event) {
9898
return
9999
}
100100

101-
if (window.Appcues) {
102-
logAppcuesClicks()
103-
}
104-
105101
// we use closest() so we don't lose clicks on, e.g. icons within a link/button
106102
// (and we have to use $.closest since IE still doesn't have built-in support for it)
107103
if (target.closest('a').length) {
@@ -115,44 +111,6 @@ export function logClick(event) {
115111
}
116112
}
117113

118-
/**
119-
* Logs Appcues public events to Mixpanel
120-
* https://docs.appcues.com/article/161-javascript-api
121-
*
122-
* Event prop building borrowed from Terra UI
123-
* https://github.com/DataBiosphere/terra-ui/pull/2463/files
124-
*/
125-
function logAppcuesClicks() {
126-
window.Appcues.on('all', (eventName, event) => {
127-
const eventProps = {
128-
'appcues.flowId': event.flowId,
129-
'appcues.flowName': event.flowName,
130-
'appcues.flowType': event.flowType,
131-
'appcues.flowVersion': event.flowVersion,
132-
'appcues.id': event.id,
133-
'appcues.interaction.category': event.interaction?.category,
134-
'appcues.interaction.destination': event.interaction?.destination,
135-
'appcues.interaction.element': event.interaction?.element,
136-
'appcues.interaction.fields': JSON.stringify(event.interaction?.fields),
137-
'appcues.interaction.formId': event.interaction?.formId,
138-
'appcues.interaction.text': event.interaction?.text, // not documented by Appcues, but observed and useful
139-
'appcues.interactionType': event.interactionType,
140-
'appcues.localeId': event.localeId,
141-
'appcues.localeName': event.localeName,
142-
'appcues.name': event.name,
143-
'appcues.sessionId': event.sessionId,
144-
'appcues.stepChildId': event.stepChildId,
145-
'appcues.stepChildNumber': event.stepChildNumber,
146-
'appcues.stepId': event.stepId,
147-
'appcues.stepNumber': event.stepNumber,
148-
'appcues.stepType': event.stepType,
149-
'appcues.timestamp': event.timestamp
150-
}
151-
log(eventName, eventProps)
152-
log('appcues:event', eventProps)
153-
})
154-
}
155-
156114
/** Log clicks on SVG element of analytics interest */
157115
export function logClickOther(target) {
158116
const props = {
@@ -522,8 +480,6 @@ export function log(name, props = {}) {
522480

523481
init = Object.assign(init, body)
524482

525-
window.Appcues && window.Appcues.identify(window.SCP.userId)
526-
527483
if (('SCP' in window && !window.SCP.isTest) || metricsApiMock) {
528484
const url = `${bardDomain}/api/event/`
529485
fetch(url, init).then(response => {

app/views/layouts/application.html.erb

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
window.SCP.featuredSpace = 'covid19'
4444
<% end %>
4545

46-
// Set the unique cookie for tracking user IDs in GA. Also used in Mixpanel and Appcues.
46+
// Set the unique cookie for tracking user IDs in GA. Also used in Mixpanel.
4747
// This is not personally identifiable, lasts for 1 year or until cleared.
4848
if ( typeof Cookies.get('user_id') === 'undefined' ) {
4949
Cookies.set('user_id', '<%= user_signed_in? ? current_user.get_metrics_uuid : SecureRandom.uuid %>', {expires: 365})
@@ -81,12 +81,6 @@
8181
</style>
8282
<% end %>
8383

84-
<script type="text/javascript" nonce="<%= content_security_policy_script_nonce %>">
85-
window.AppcuesSettings = {
86-
enableURLDetection: true
87-
};
88-
</script>
89-
<script type="text/javascript" nonce="<%= content_security_policy_script_nonce %>" src="https://fast.appcues.com/49767.js"></script>
9084

9185
</head>
9286
<body <%= @selected_branding_group.present? ? "data-branding-id=#{@selected_branding_group.name_as_id}" : nil %>>

config/initializers/content_security_policy.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,7 @@
6868
allowed_connect_sources.push('ws://localhost:3036')
6969
allowed_connect_sources.push('ws://127.0.0.1:3036')
7070
end
71-
# For appcues
72-
allowed_connect_sources.push('https://*.appcues.com')
73-
allowed_connect_sources.push('https://*.appcues.net')
74-
allowed_connect_sources.push('wss://*.appcues.net')
75-
allowed_connect_sources.push('wss://*.appcues.com')
71+
7672
config.csp = {
7773
# "meta" values. these will shape the header, but the values are not included in the header.
7874
preserve_schemes: true, # default: false. Schemes are removed from host sources to save bytes and discourage mixed content.
@@ -81,7 +77,7 @@
8177
# directive values: these values will directly translate into source directives
8278
default_src: %w('self'),
8379
block_all_mixed_content: true, # see http://www.w3.org/TR/mixed-content/
84-
frame_src: %w('self' https://*.appcues.com), # if child-src isn't supported, the value for frame-src will be set.
80+
frame_src: %w('self'), # if child-src isn't supported, the value for frame-src will be set.
8581
font_src: %w('self' data: https://fonts.googleapis.com https://fonts.google.com https://fonts.gstatic.com ),
8682
form_action: %w('self' https://accounts.google.com),
8783
connect_src: allowed_connect_sources,
@@ -92,9 +88,8 @@
9288
script_src: %w('self' blob: 'unsafe-eval' 'unsafe-inline' 'strict-dynamic' https://cdn.plot.ly https://cdn.datatables.net
9389
https://www.google-analytics.com https://cdnjs.cloudflare.com https://maxcdn.bootstrapcdn.com
9490
https://use.fontawesome.com https://js-agent.newrelic.com https://bam.nr-data.net
95-
https://*.appcues.com https://*.appcues.net https://*.soe.ucsc.edu),
96-
style_src: %w('self' blob: https://maxcdn.bootstrapcdn.com
97-
https://*.appcues.com https://*.appcues.net https://fonts.googleapis.com https://fonts.google.com 'unsafe-inline'),
91+
https://*.soe.ucsc.edu),
92+
style_src: %w('self' blob: https://maxcdn.bootstrapcdn.com https://fonts.googleapis.com https://fonts.google.com 'unsafe-inline'),
9893
upgrade_insecure_requests: true # see https://www.w3.org/TR/upgrade-insecure-requests/
9994
}
10095

0 commit comments

Comments
 (0)