Last active
May 29, 2021 13:21
-
-
Save brainysmurf/9829a9f2a7553ef80245fcbf113496cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This is my version of what I embed into libraries I want to track, as cluster. | |
* This way it ensures that consistent name, version used throughout, and easy to define namespace | |
* Note use of "name" "space" parameters | |
*/ | |
function TrackMyself ({name='dottie', space=null, version='v1.5', ...kwargs}={}) { | |
if (Object.keys(kwargs).length>0) throw new TypeError("Unexpected param received"); | |
const track = cttLibTracker.TrackMyself; | |
const options = { | |
name: space != null ? `${name}_${space}`: name, | |
version | |
}; | |
track.stamp(options) | |
return track; | |
} | |
/** | |
* Usage | |
*/ | |
function report () { | |
const track = TrackMyself({sspace: 'init'}); // throws TypeError | |
const track = TrackMyself({space: 'init'}); | |
const output = track.currentUserUsage(); | |
Logger.log(output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment