Synthetics scripted browser boilerplate? Show and tell!

Of the scripted browser and API scripts I’ve created in Synthetics, it is very painfully obvious which ones were my first attempts with and which ones are more recent. They all work fine, but the more recent scripts are cleaner and almost standardized…but not quite.

My question for my fellow explorers is: have you created and regularly use your own “boilerplate” for synthetics scripts? Would you be willing to share a snippet?

Alternatively, do you have a “template” script (this is my method) disabled and without notifications that is used as a starting point?

EDIT: New Relic documentation is - yes - very awesome. There are plenty of examples included. That said, I’m sure plenty of you have put your own spin on it, refactored, reorganized, or generally up-leveled from those examples. I’m looking to learn from your collective genius.

1 Like

Great question @annnovakowski - I’m wondering if @anon85944545, @stefan_garnham, or @MKhanna can share how they help their teams standardize on script templates.

Also, if you haven’t seen it, we just posted a New Relic Handbook template for exactly this kind of thing. We know that teams using New Relic need to work from standards, and those standards need to be documented. We don’t have a section for Synthetics scripts, but that could be a great addition. Handbook is here:


we’re on the cusp of creating a standard for the synthetics scripts; but haven’t quite hit that nail yet with our github hammer :slight_smile:

historically, I setup my scripts for other work (non-synthetics, to date) in a standard high-level format:

#Top of Script
-- Summary/Example/Versioning

-- Definition of all functions to be used in this script

-- Global variable declaration

-- Execution of tasks

-- Stop logging, export results, etc.

Generally, I try to keep all of my scripts within this basic framework; no matter their language or purpose. I have found it is generic enough to scale out for the future, and the standard helps me to read through the stuff I created XX time back and forgot what it was for :wink:

Love the idea of sharing the handbook, hopefully we can all contribute with some pull requests to contribute with the evolution!


I have added my template scripts to the forum for both scripted browser and scripted api. Aside from some helper functions I have written these are what I have used.