From 3b19ee7787360d8be207b87a6423d30912004537 Mon Sep 17 00:00:00 2001 From: Ahmed Osman Date: Tue, 2 Feb 2021 12:53:56 +0200 Subject: [PATCH] Adding Clarity Template --- Microsof Clarity.tpl | 230 +++++++++++++++++++++++++++++++++++++++++++ msft_logo.png | Bin 0 -> 365 bytes 2 files changed, 230 insertions(+) create mode 100644 Microsof Clarity.tpl create mode 100644 msft_logo.png diff --git a/Microsof Clarity.tpl b/Microsof Clarity.tpl new file mode 100644 index 0000000..63f1bc0 --- /dev/null +++ b/Microsof Clarity.tpl @@ -0,0 +1,230 @@ +___TERMS_OF_SERVICE___ + +By creating or modifying this file you agree to Google Tag Manager's Community +Template Gallery Developer Terms of Service available at +https://developers.google.com/tag-manager/gallery-tos (or such other URL as +Google may provide), as modified from time to time. + + +___INFO___ + +{ + "type": "TAG", + "id": "cvt_temp_public_id", + "version": 1, + "securityGroups": [], + "displayName": "Microsof Clarity", + "categories": ["AFFILIATE_MARKETING", "ADVERTISING"], + "brand": { + "id": "Microsoft", + "displayName": "Microsoft", + "thumbnail": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACABAMAAAAxEHz4AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAAElBMVEUAAADyUCJ/ugAApO//uQD///8951e2AAAAAXRSTlMAQObYZgAAAAFiS0dEBfhv6ccAAAAHdElNRQfkCgUWITsZUDiiAAAAS0lEQVRo3u3MQQ3AIAAEsMuCAGZhCkiwgH9NOLj3Hq2A5q1m8nxVBAKBQCAQCAQCgUAgEPSAP9jVSsapBAKBQCAQCAQCgUAgEPTgAruK0CdlWNSzAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIwLTEwLTA1VDIyOjMzOjU5KzAwOjAwPT1n8QAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMC0xMC0wNVQyMjozMzo1OSswMDowMExg300AAAAASUVORK5CYII\u003d" + }, + "description": "Clarity is a user behavior analytics tool, which helps you understand how users are interacting with your website. Supported features include:\nSession Recordings\nHeatmaps\nML Insights", + "containerContexts": [ + "WEB" + ] +} + + +___TEMPLATE_PARAMETERS___ + +[ + { + "type": "TEXT", + "name": "projectId", + "displayName": "Clarity Project Id", + "simpleValueType": true, + "help": "Copy your clarity project Id here. You can find it in the project Url from the browser. Example: https://clarity.microsoft.com/projects/view/\"projectId\"/", + "valueValidators": [ + { + "type": "NON_EMPTY", + "errorMessage": "You must provide a clarity project Id" + }, + { + "type": "REGEX", + "args": [ + "[0-9a-z]+" + ], + "errorMessage": "Incorrect project Id. You can find it in the project Url from the browser. Example: https://clarity.microsoft.com/projects/view/\"projectId\"/" + } + ] + } +] + + +___SANDBOXED_JS_FOR_WEB_TEMPLATE___ + +// Require the necessary APIs +const injectScript = require('injectScript'); +const queryPermission = require('queryPermission'); +const createArgumentsQueue = require('createArgumentsQueue'); + +//Create clarity const +const clarity = createArgumentsQueue('clarity', 'clarity.q'); + +// Reconstruct customer clarity script URL +const url = "https://www.clarity.ms/tag/"+data.projectId; + +// Handle Success +const onCustomerSuccess = () => { + data.gtmOnSuccess(); +}; + +// Handle Failure +const onCustomerFailure = () => { + data.gtmOnFailure(); +}; + + +// If the URL input by the user matches the permissions set for the template, +// inject the script with the onSuccess and onFailure methods as callbacks. +if (queryPermission('inject_script', "https://www.clarity.ms")) { + injectScript(url, onCustomerSuccess, onCustomerFailure); +} else { + data.gtmOnFailure(); +} + + +___WEB_PERMISSIONS___ + +[ + { + "instance": { + "key": { + "publicId": "inject_script", + "versionId": "1" + }, + "param": [ + { + "key": "urls", + "value": { + "type": 2, + "listItem": [ + { + "type": 1, + "string": "https://www.clarity.ms/*" + } + ] + } + } + ] + }, + "clientAnnotations": { + "isEditedByUser": true + }, + "isRequired": true + }, + { + "instance": { + "key": { + "publicId": "access_globals", + "versionId": "1" + }, + "param": [ + { + "key": "keys", + "value": { + "type": 2, + "listItem": [ + { + "type": 3, + "mapKey": [ + { + "type": 1, + "string": "key" + }, + { + "type": 1, + "string": "read" + }, + { + "type": 1, + "string": "write" + }, + { + "type": 1, + "string": "execute" + } + ], + "mapValue": [ + { + "type": 1, + "string": "clarity" + }, + { + "type": 8, + "boolean": true + }, + { + "type": 8, + "boolean": true + }, + { + "type": 8, + "boolean": true + } + ] + }, + { + "type": 3, + "mapKey": [ + { + "type": 1, + "string": "key" + }, + { + "type": 1, + "string": "read" + }, + { + "type": 1, + "string": "write" + }, + { + "type": 1, + "string": "execute" + } + ], + "mapValue": [ + { + "type": 1, + "string": "clarity.q" + }, + { + "type": 8, + "boolean": true + }, + { + "type": 8, + "boolean": true + }, + { + "type": 8, + "boolean": true + } + ] + } + ] + } + } + ] + }, + "clientAnnotations": { + "isEditedByUser": true + }, + "isRequired": true + } +] + + +___TESTS___ + +scenarios: [] + + +___NOTES___ + +Created on 2/2/2021, 12:41:15 PM + + diff --git a/msft_logo.png b/msft_logo.png new file mode 100644 index 0000000000000000000000000000000000000000..59cbe36c3772a1e119fbe4eb00d2091c038f3682 GIT binary patch literal 365 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?I3?vN&YJLDImUKs7M+SzC{oH>NS%G|oWRD7{FBlj~4Hy_+B``2p&0t^;DAn&`U|910 z|4xSg|Nq-Q58nn9Wh@Eu3ubV5b|VeMN%D4gVf~T+@;H#gUgGKN%Kn6lRZP)ZGQeUH zP{`ZU#W5t~-rF;dyayB*ST>w)Vn|Em^4QQ&?`yH+yWHA_XKT|w)r7JzH99B=a6qUp z4fZ##dL3JdD)@kDch?2=)QBsafySzqxJHzuB$lLFB^RXvDF!10BLiJS16>2t5F;Zi tV`D2*OKk%KD+2>t+w_kp8glbfGSez?Yw$_94-6*;22WQ%mvv4FO#mB+YDNG6 literal 0 HcmV?d00001