-
Notifications
You must be signed in to change notification settings - Fork 142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow configuring heap integration settings #734
base: master
Are you sure you want to change the base?
Allow configuring heap integration settings #734
Conversation
The heap integration previously did not allow configuring the CDN that serves the heap snippet or passing any heap options. This change introduces new options to allow configuring both.
@@ -21,7 +21,9 @@ var toString = Object.prototype.toString; // in case this method has been overri | |||
var Heap = (module.exports = integration('Heap') | |||
.global('heap') | |||
.option('appId', '') | |||
.tag('<script src="//cdn.heapanalytics.com/js/heap-{{ appId }}.js">')); | |||
.option('hostname', 'cdn.heapanalytics.com') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be some variation in how different integrations name this sort of parameter, so I wasn't sure of the best name. I'm happy to change to something else.
@@ -21,7 +21,9 @@ var toString = Object.prototype.toString; // in case this method has been overri | |||
var Heap = (module.exports = integration('Heap') | |||
.global('heap') | |||
.option('appId', '') | |||
.tag('<script src="//cdn.heapanalytics.com/js/heap-{{ appId }}.js">')); | |||
.option('hostname', 'cdn.heapanalytics.com') | |||
.option('options', {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heap JS docs list some of the options, but there are additional options which are not documented. That leads me to believe that it might be best to just provide a single options object, since the allowed options might be account-specific and it might be confusing to provide some configuration options here that aren't available to all accounts. However, I'm happy to split this out into specific configuration options.
What does this PR do?
The current heap integration has two limitations which are proving challenging for our segment deployment:
secureCookie
ordisableTextCapture
.This PR adds additional configuration options to the heap integration to support changing both.
Are there breaking changes in this PR?
No.
Testing
I used the (very slick and excellent) local runner to test manually. I didn't see an easy way to add any tests, since it's hard to mock the underlying heap object. I'm also not sure the tests would be hugely valuable, since they would essentially be asserting that the code exists as written rather than really testing behavior. I am open to suggestions about a better way to handle this!
Any background context you want to provide?
No
Is there parity with the server-side/android/iOS integration components (if applicable)?
N/A
Does this require a new integration setting? If so, please explain how the new setting works
This change introduces two new optional settings:
hostname
(string
): Allows changing the URL from which the heap snippet is loaded. It defaults to "cdn.heapanalytics.com", the current hard-coded value, to preserve backwards compatibility.options
(object
): Allows passing an arbitrary set of configuration options to heap. They are passed to the heap JS code as is. Defaults to{}
to preserve backwards compatibility.Links to helpful docs and other external resources
Heap JS options