Skip to content

Instantly share code, notes, and snippets.

@khpeet
Created August 25, 2017 14:28
Show Gist options
  • Save khpeet/068e332c9dac913ea6a795fc79565001 to your computer and use it in GitHub Desktop.
Save khpeet/068e332c9dac913ea6a795fc79565001 to your computer and use it in GitHub Desktop.
Send Akami headers via NR Synthetic script to Insights
/*
--------- SCRIPT SUMMARY ---------
Author(s) : Keagan Peet
Date : 8/24/17
Version : 1.0.0
Notes : Akami response headers to Insights for a single page.
*/
var assert = require('assert');
var request = require('request');
var options = {
url: 'Insert_YOUR_URL or ENDPOINT', //modify this to a specific element or another URL if needed.
headers: {
'Pragma': 'akamai-x-cache-on, akamai-x-cache-remote-on, akamai-x-check-cacheable, akamai-x-get-cache-key, akamai-x-get-extracted-values, akamai-x-get-nonces, akamai-x-get-ssl-client-session-id, akamai-x-get-true-cache-key, akamai-x-serial-no, akamai-x-get-request-id, akamai-x-request-trace, akamai-x--meta-trace, akama-xi-get-extracted-values'
}
};
request.get(options, function aRequest(error, response, body) {
if (!error && response.statusCode == 200) {
var object = response.headers;
//console.log(object);
for (var i in object){
console.log(i + ":" + object[i]);
$util.insights.set(i, object[i]); // send key/value pair to insights
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment