Skip to content

Instantly share code, notes, and snippets.

@sahava
Last active November 20, 2023 12:40
Show Gist options
  • Save sahava/6aef5fc914ec32a29df162747168f658 to your computer and use it in GitHub Desktop.
Save sahava/6aef5fc914ec32a29df162747168f658 to your computer and use it in GitHub Desktop.
Custom server-side Google Tag Manager client template for logging the IP address of outgoing requests
___INFO___
{
"type": "CLIENT",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "Log outgoing request IP address",
"brand": {
"id": "brand_dummy",
"displayName": ""
},
"description": "",
"containerContexts": [
"SERVER"
]
}
___TEMPLATE_PARAMETERS___
[]
___SANDBOXED_JS_FOR_SERVER___
const log = require('logToConsole');
const returnResponse = require('returnResponse');
const sendHttpGet = require('sendHttpGet');
require('claimRequest')();
sendHttpGet('https://curlmyip.org')
.then((result) => {
log(result);
returnResponse();
});
___SERVER_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "logging",
"versionId": "1"
},
"param": [
{
"key": "environments",
"value": {
"type": 1,
"string": "debug"
}
}
]
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "send_http",
"versionId": "1"
},
"param": [
{
"key": "allowedUrls",
"value": {
"type": 1,
"string": "any"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "return_response",
"versionId": "1"
},
"param": []
},
"isRequired": true
}
]
___TESTS___
scenarios: []
___NOTES___
Created on 20/11/2023, 12:23:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment