Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:32:45 +08:00
commit c02dafae1d
41 changed files with 17283 additions and 0 deletions

View File

@@ -0,0 +1,24 @@
# Example Asset File
This placeholder represents where asset files would be stored.
Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
Asset files are NOT intended to be loaded into context, but rather used within
the output Claude produces.
Example asset files from other skills:
- Brand guidelines: logo.png, slides_template.pptx
- Frontend builder: hello-world/ directory with HTML/React boilerplate
- Typography: custom-font.ttf, font-family.woff2
- Data: sample_data.csv, test_dataset.json
## Common Asset Types
- Templates: .pptx, .docx, boilerplate directories
- Images: .png, .jpg, .svg, .gif
- Fonts: .ttf, .otf, .woff, .woff2
- Boilerplate code: Project directories, starter files
- Icons: .ico, .svg
- Data files: .csv, .json, .xml, .yaml
Note: This is a text placeholder. Actual assets can be any file type.

View File

@@ -0,0 +1,168 @@
___INFO___
{
"type": "TAG",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "My Custom Tag",
"categories": ["ANALYTICS", "MARKETING"],
"brand": {
"id": "brand_id",
"displayName": "My Brand",
"thumbnail": ""
},
"description": "A custom tag template for...",
"containerContexts": [
"WEB"
]
}
___TEMPLATE_PARAMETERS___
[
{
"type": "TEXT",
"name": "endpoint",
"displayName": "API Endpoint",
"simpleValueType": true,
"help": "Enter the API endpoint URL",
"valueValidators": [
{
"type": "NON_EMPTY"
},
{
"type": "REGEX",
"args": ["^https?://.*"]
}
]
},
{
"type": "TEXT",
"name": "eventName",
"displayName": "Event Name",
"simpleValueType": true,
"defaultValue": "custom_event"
},
{
"type": "CHECKBOX",
"name": "debug",
"checkboxText": "Enable Debug Mode",
"simpleValueType": true,
"defaultValue": false
}
]
___SANDBOXED_JS_FOR_WEB_TEMPLATE___
// Require necessary APIs
const sendPixel = require('sendPixel');
const logToConsole = require('logToConsole');
const encodeUriComponent = require('encodeUriComponent');
// Access template data
const endpoint = data.endpoint;
const eventName = data.eventName;
const debug = data.debug;
// Debug logging
if (debug) {
logToConsole('Custom Tag Firing', {
endpoint: endpoint,
eventName: eventName
});
}
// Build pixel URL
const pixelUrl = endpoint + '?event=' + encodeUriComponent(eventName);
// Fire pixel
sendPixel(pixelUrl, data.gtmOnSuccess, data.gtmOnFailure);
___WEB_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "logging",
"versionId": "1"
},
"param": [
{
"key": "environments",
"value": {
"type": 1,
"string": "debug"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
},
{
"instance": {
"key": {
"publicId": "send_pixel",
"versionId": "1"
},
"param": [
{
"key": "allowedUrls",
"value": {
"type": 1,
"string": "any"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
}
]
___TESTS___
scenarios:
- name: Tag fires successfully
code: |-
const mockData = {
endpoint: 'https://example.com/pixel',
eventName: 'test_event',
debug: false
};
// Call runCode to run the template's code.
runCode(mockData);
// Verify that the tag finished successfully.
assertApi('gtmOnSuccess').wasCalled();
- name: Debug mode logs to console
code: |-
const mockData = {
endpoint: 'https://example.com/pixel',
eventName: 'test_event',
debug: true
};
runCode(mockData);
// Verify logging occurred
assertApi('logToConsole').wasCalledWith('Custom Tag Firing', {
endpoint: 'https://example.com/pixel',
eventName: 'test_event'
});
___NOTES___
Created using Custom Template Boilerplate

View File

@@ -0,0 +1,133 @@
___INFO___
{
"type": "MACRO",
"id": "cvt_temp_public_id",
"version": 1,
"securityGroups": [],
"displayName": "My Custom Variable",
"categories": ["UTILITY"],
"brand": {
"id": "brand_id",
"displayName": "My Brand"
},
"description": "A custom variable template for...",
"containerContexts": [
"WEB"
]
}
___TEMPLATE_PARAMETERS___
[
{
"type": "TEXT",
"name": "cookieName",
"displayName": "Cookie Name",
"simpleValueType": true,
"help": "Name of the cookie to read",
"valueValidators": [
{
"type": "NON_EMPTY"
}
]
},
{
"type": "TEXT",
"name": "defaultValue",
"displayName": "Default Value",
"simpleValueType": true,
"help": "Value to return if cookie is not found"
}
]
___SANDBOXED_JS_FOR_WEB_TEMPLATE___
// Require necessary APIs
const getCookieValues = require('getCookieValues');
const logToConsole = require('logToConsole');
// Access template data
const cookieName = data.cookieName;
const defaultValue = data.defaultValue;
// Get cookie values
const cookies = getCookieValues(cookieName);
// Return first cookie value or default
if (cookies && cookies.length > 0) {
return cookies[0];
}
return defaultValue;
___WEB_PERMISSIONS___
[
{
"instance": {
"key": {
"publicId": "get_cookies",
"versionId": "1"
},
"param": [
{
"key": "cookieAccess",
"value": {
"type": 1,
"string": "any"
}
}
]
},
"clientAnnotations": {
"isEditedByUser": true
},
"isRequired": true
}
]
___TESTS___
scenarios:
- name: Returns cookie value when exists
code: |-
mock('getCookieValues', (name) => {
if (name === 'testCookie') {
return ['cookieValue'];
}
return [];
});
const mockData = {
cookieName: 'testCookie',
defaultValue: 'default'
};
let result = runCode(mockData);
assertThat(result).isEqualTo('cookieValue');
- name: Returns default value when cookie does not exist
code: |-
mock('getCookieValues', (name) => {
return [];
});
const mockData = {
cookieName: 'nonExistentCookie',
defaultValue: 'defaultValue'
};
let result = runCode(mockData);
assertThat(result).isEqualTo('defaultValue');
___NOTES___
Created using Custom Variable Template Boilerplate