Skip to content

Instantly share code, notes, and snippets.

@fIa5h
fIa5h / urlCaptureIntercom.js
Created December 20, 2018 19:57
Installation script for Intercom to include current URL as a field on the lead object passed to SFDC
<script>
/*
INSTRUCTIONS
To begin syncing this parameters with SFDC you will need to excplitly reference
them as qualification attributes in your Intercom Qualification Data settings in the Intercom UI:
https://www.intercom.com/help/faqs-and-troubleshooting/capture-qualify-and-convert-leads/what-is-qualification-data
Then, you will need to map those qualification attributes to your SFDC lead fields in the Intercom UI.
See the "Map and sync your qualification attributes" section of this document:
https://www.intercom.com/help/apps-in-intercom/apps/salesforce-app
*/
@fIa5h
fIa5h / intercomUserUpdate.js
Created December 6, 2018 00:28
Use live Intercom events without a hard page refresh
//does Intercom exist in this scope
if(window.Intercom){
//track our event
window.Intercom("trackEvent", "YOUR EVENT NAME");
setTimeout(function(){
//refresh our user, so we can take actions based off of the action above
Intercom("update", {last_request_at: parseInt((new Date()).getTime()/1000)})
}, 500);
};
@fIa5h
fIa5h / dynamicQueryStringIntercom.js
Last active November 30, 2018 17:55
This Intercom installation script dynamically captures query string parameters and enables you to map them into CDAs. Please follow the INSTRUCTIONS section in the comments, then please remove comments and set your APP_ID before using. This should be installed the same as the standard Intercom installation, like so: https://developers.intercom.c…
<script>
/*
INSTRUCTIONS
To begin syncing these parameters with SFDC you will need to excplitly reference
them as qualification attributes in your Intercom Qualification Data settings in the Intercom UI:
https://www.intercom.com/help/faqs-and-troubleshooting/capture-qualify-and-convert-leads/what-is-qualification-data
Then, you will need to map those qualification attributes to your SFDC lead fields in the Intercom UI.
See the "Map and sync your qualification attributes" section of this document:
<script>
(function() {
var w = window;
var ic = w.Intercom;
if (typeof ic === "function") {
ic('reattach_activator');
ic('update', intercomSettings);
} else {
var d = document;
var i = function() { i.c(arguments) };
@fIa5h
fIa5h / webhook_payload.json
Created September 18, 2018 20:01
Example Intercom web-hook payload
{
"type": "notification_event_data",
"item": {
"type": "conversation",
"id": "18255009678",
"created_at": 1535647240,
"updated_at": 1535952882,
"user": {
"type": "user",
"id": "5b881d43dc78d66a0817eab9",
@fIa5h
fIa5h / directFunnelScript.js
Created January 4, 2018 01:18
Custom instrumentation to record strict, direct funnels within New Relic Insights
//instantiate globally
//below is the global array where we'll record the last 6 steps
window.NewRelicDirectFunnelArray = ["", "", "", "", "", ""];
//and the function we'll use to manage the data structure
window.NewRelicDirectFunnelFunction = function(pageActionName){
//capture a delimited string containing the last 6 pageActions since the initial pageload
var previousSixPageActionsString = window.NewRelicDirectFunnelArray.join("||");
//dequeue the oldest pageAction value out of the queue
window.NewRelicDirectFunnelArray.shift();
//push the newest pageAction value into the queue
@fIa5h
fIa5h / AMI_NR.js
Last active April 22, 2020 17:05
Ryan & Bruce
/*
New Relic GPT ad monitoring code
//
This snippet captures PageActions containing references to Google publisher tag ads
Should you have any questions about this, please reach out to me at rmusser@newrelic.com
Please note that you must be using New Relic's SPA browser agent.
//
*/
//
//first, make sure the newrelic object exists properly
@fIa5h
fIa5h / gist:92b6e60903351c275c4c530bd1df18e3
Created October 23, 2017 16:29
NR Dynamic Baselining Algos
New Relic automatically discovers seasonality and evaluates the use of 4 algorithms for unique time series slices. Further, we've built an extensible ensemble algorithm that we continue to add to. In regards to seasonality, we've applied a technique common in signal processing, called Fast Fourier Transforms (FFT’s). FFT’s can be used to identify the underlying frequency in a time series. We use FFT’s to sniff out good candidates for 'seasons', then try the candidates on the baseline bootstrapping data and see if works better than the default. Currently in our ensemble approach we evaluate four options: triple exponential smoothing with the discovered seasonality, triple exponential smoothing with the default seasonality (Holt-Winters), double exponential smoothing (i.e. look only at recency and trend factors) and single exponential smoothing (just look at recency). Lastly, end users do not currently have access to modify these dynamic baselining algorithms.
@fIa5h
fIa5h / NewRelicMeteor.markdown
Last active May 4, 2017 18:27
My running log of implementing New Relic into a Meteor application

Utilizing New Relic APM inside of a Meteor application

This is a running log of information I plan to use to help me research, understand, implement and communicate why and how to utilize New Relic's APM suite inside of a Meteor application.

Why?

Meteor's rise to prominence (currently 30th ranked project on GitHub) has brought challenges for developers that choose to utilize the framework in a production environment. One of those challenges is application monitoring. With the downfall of Kadira, Meteor's defacto go to application monitoring service, developers have been relegated primarily to self hosting Kadira, or jumping into the larger Galaxy platform for insights.

Enter New Relic and it's industry leading APM suite.

#The api_console

The api console can be called from app/Console similar to this: ./cake api_console param param param

##Non user removing calls

./cake api_console "all"

This call assigns all users to the proper rooms based upon the most recent api dumps for all institutions

./cake api_console "$org_id" "$org_id"