{
    "exportFormatVersion": 2,
    "exportTime": "2025-06-03 14:18:14",
    "containerVersion": {
        "path": "accounts/6296815860/containers/220978468/versions/0",
        "accountId": "6296815860",
        "containerId": "220978468",
        "containerVersionId": "0",
        "container": {
            "path": "accounts/6296815860/containers/220978468",
            "accountId": "6296815860",
            "containerId": "220978468",
            "name": "Pinterest - Server",
            "publicId": "GTM-MKNT8W86",
            "usageContext": [
                "SERVER"
            ],
            "fingerprint": "1748960128261",
            "tagManagerUrl": "https://tagmanager.google.com/#/container/accounts/6296815860/containers/220978468/workspaces?apiLink=container",
            "features": {
                "supportUserPermissions": true,
                "supportEnvironments": true,
                "supportWorkspaces": true,
                "supportGtagConfigs": false,
                "supportBuiltInVariables": true,
                "supportClients": true,
                "supportFolders": true,
                "supportTags": true,
                "supportTemplates": true,
                "supportTriggers": true,
                "supportVariables": true,
                "supportVersions": true,
                "supportZones": true,
                "supportTransformations": true
            },
            "tagIds": [
                "GTM-MKNT8W86"
            ]
        },
        "tag": [
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "tagId": "549",
                "name": "Pinterest - Conversions Tag",
                "type": "cvt_PL3ZM",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "apiAccessToken",
                        "value": "{{@ Pinterest Token}}"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "testMode",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "eventName",
                        "value": "inherit"
                    },
                    {
                        "type": "LIST",
                        "key": "serverEventDataList",
                        "list": [
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "event_id"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Event ID}}"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "type": "LIST",
                        "key": "userDataList",
                        "list": [
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "em"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Customer Email}}"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "fn"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Customer First Name}}"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "ln"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Customer Last Name}}"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "external_id"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Customer ID}}"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "country"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Customer Country}}"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "zp"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Customer Zip}}"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "name",
                                        "value": "ph"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "{{DLV - Customer Phone}}"
                                    }
                                ]
                            }
                        ]
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "logMode",
                        "value": "donotlog"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "overrideMode",
                        "value": "true"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "advertiserId",
                        "value": "{{@ Pinterest ID}}"
                    }
                ],
                "fingerprint": "1748960251446",
                "firingTriggerId": [
                    "542"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            }
        ],
        "trigger": [
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "triggerId": "542",
                "name": "Pinterest Trigger",
                "type": "ALWAYS",
                "filter": [
                    {
                        "type": "MATCH_REGEX",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Event Name}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "page_view|view_item_list|view_item|add_to_cart|purchase"
                            }
                        ]
                    },
                    {
                        "type": "CONTAINS",
                        "parameter": [
                            {
                                "type": "TEMPLATE",
                                "key": "arg0",
                                "value": "{{Client Name}}"
                            },
                            {
                                "type": "TEMPLATE",
                                "key": "arg1",
                                "value": "GA4"
                            }
                        ]
                    }
                ],
                "fingerprint": "1748960270302"
            }
        ],
        "variable": [
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "537",
                "name": "DLV - Customer Email",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_customer_email"
                    }
                ],
                "fingerprint": "1748959612069",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "538",
                "name": "DLV - Event ID",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_event_id"
                    }
                ],
                "fingerprint": "1748960146141",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "539",
                "name": "DLV - Customer Last Name",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_customer_last_name"
                    }
                ],
                "fingerprint": "1748960146141",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "540",
                "name": "@ Pinterest Token",
                "type": "c",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "value",
                        "value": "invullen"
                    }
                ],
                "fingerprint": "1748960285389",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "543",
                "name": "DLV - Customer ID",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_customer_id"
                    }
                ],
                "fingerprint": "1748960146202",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "544",
                "name": "DLV - Customer Phone",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_customer_phone"
                    }
                ],
                "fingerprint": "1748960146202",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "545",
                "name": "DLV - Customer First Name",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_customer_first_name"
                    }
                ],
                "fingerprint": "1748960146202",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "546",
                "name": "DLV - Customer Zip",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_customer_zip"
                    }
                ],
                "fingerprint": "1748960146202",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "547",
                "name": "DLV - Customer Country",
                "type": "ed",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "keyPath",
                        "value": "x_customer_country"
                    }
                ],
                "fingerprint": "1748960146202",
                "formatValue": {}
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "variableId": "548",
                "name": "@ Pinterest ID",
                "type": "c",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "value",
                        "value": "invullen"
                    }
                ],
                "fingerprint": "1748960278731",
                "formatValue": {}
            }
        ],
        "builtInVariable": [
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "type": "EVENT_NAME",
                "name": "Event Name"
            },
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "type": "CLIENT_NAME",
                "name": "Client Name"
            }
        ],
        "fingerprint": "1748960294361",
        "tagManagerUrl": "https://tagmanager.google.com/#/versions/accounts/6296815860/containers/220978468/versions/0?apiLink=version",
        "customTemplate": [
            {
                "accountId": "6296815860",
                "containerId": "220978468",
                "templateId": "541",
                "name": "Pinterest API for Conversions Tag",
                "fingerprint": "1748960146141",
                "templateData": "___TERMS_OF_SERVICE___\n\nBy creating or modifying this file you agree to Google Tag Manager's Community\nTemplate Gallery Developer Terms of Service available at\nhttps://developers.google.com/tag-manager/gallery-tos (or such other URL as\nGoogle may provide), as modified from time to time.\n\n\n___INFO___\n\n{\n  \"type\": \"TAG\",\n  \"id\": \"cvt_PL3ZM\",\n  \"version\": 1,\n  \"securityGroups\": [],\n  \"displayName\": \"Pinterest API for Conversions Tag\",\n  \"categories\": [\n    \"CONVERSIONS\",\n    \"TAG_MANAGEMENT\"\n  ],\n  \"brand\": {\n    \"thumbnail\": \"data:image/png;base64,iVBORw0KGg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mOgzJjjTDDAHhnvl7h0XL8Ilju5ROR5C+WSon8zMv/L6SiasEXFotPV9Zq/b9YVn+w+98cuv1qOp0UwQWVcfIB32+GQ0Fx7um7M/NMvTrx86/y9jgjj5Wjybe44JYqMjSQu7RovmktI+KjVlsKgj4OCv1Pgjl+Q3i4HX8uGkxpGU9pYjUXvxfGnZFQCUzfqtv5UaXtkkM9Zr/3TWqdWRJSxae3a/cRGA7y5XaiQzTETcnV8OqZLfEYvX1dthZ7qBpIAwqt/9FQEgAGJrff0L+bljy83BYQNd/eNMELcyQZzOBDHgunw87UzTkzkoghq++U8nANRotZFEanKmGcYwQVzABPE9Joj/ZYJYyATxBBPEM92ez5+Vr68WyTn8fflJ7MSB+DeP/G8AiLllTCtHBPYAAAAASUVORK5CYII\\u003d\",\n    \"displayName\": \"pinterest\",\n    \"id\": \"github.com_pinterest\"\n  },\n  \"description\": \"A server-side Tag to fire events to the Pinterest Conversions API.\",\n  \"containerContexts\": [\n    \"SERVER\"\n  ]\n}\n\n\n___TEMPLATE_PARAMETERS___\n\n[\n  {\n    \"type\": \"TEXT\",\n    \"name\": \"advertiserId\",\n    \"displayName\": \"Advertiser ID\",\n    \"simpleValueType\": true,\n    \"valueValidators\": [\n      {\n        \"type\": \"NON_EMPTY\"\n      },\n      {\n        \"args\": [\n          \"549\\\\d{9}\"\n        ],\n        \"type\": \"REGEX\"\n      }\n    ],\n    \"help\": \"Pinterest Advertiser ID. You can find it by logging to the Pinterest account that owns your advertiser account, then go to \\\"ads.pinterest.com\\\". In the top navigation section, click on \\\"Viewing: \\\" and the advertiser id will be the number underneath the ad account name in the drop down menu. Advertiser Id usually starts with 549...\"\n  },\n  {\n    \"type\": \"TEXT\",\n    \"name\": \"apiAccessToken\",\n    \"displayName\": \"API Access Token\",\n    \"simpleValueType\": true,\n    \"help\": \"To use the Pinterest Conversions API, you need an access token.\",\n    \"valueValidators\": [\n      {\n        \"type\": \"NON_EMPTY\"\n      }\n    ]\n  },\n  {\n    \"type\": \"RADIO\",\n    \"name\": \"eventName\",\n    \"radioItems\": [\n      {\n        \"value\": \"inherit\",\n        \"subParams\": [],\n        \"displayValue\": \"Inherit from client\"\n      },\n      {\n        \"value\": \"pinterestEventName\",\n        \"displayValue\": \"Override client\",\n        \"subParams\": [\n          {\n            \"type\": \"SELECT\",\n            \"name\": \"eventNameStandard\",\n            \"macrosInSelect\": false,\n            \"selectItems\": [\n              {\n                \"value\": \"add_to_cart\",\n                \"displayValue\": \"add_to_cart\"\n              },\n              {\n                \"value\": \"checkout\",\n                \"displayValue\": \"checkout\"\n              },\n              {\n                \"value\": \"custom\",\n                \"displayValue\": \"custom\"\n              },\n              {\n                \"value\": \"lead\",\n                \"displayValue\": \"lead\"\n              },\n              {\n                \"value\": \"page_visit\",\n                \"displayValue\": \"page_visit\"\n              },\n              {\n                \"value\": \"search\",\n                \"displayValue\": \"search\"\n              },\n              {\n                \"value\": \"signup\",\n                \"displayValue\": \"signup\"\n              },\n              {\n                \"value\": \"view_category\",\n                \"displayValue\": \"view_category\"\n              },\n              {\n                \"value\": \"watch_video\",\n                \"displayValue\": \"watch_video\"\n              }\n            ],\n            \"simpleValueType\": true,\n            \"defaultValue\": \"page_visit\"\n          }\n        ]\n      }\n    ],\n    \"simpleValueType\": true,\n    \"displayName\": \"Event Name\",\n    \"defaultValue\": \"inherit\",\n    \"help\": \"Set the event name you want to send to Pinterest Conversions API. You can either inherit it from what you defined in Web container (client) or define a new Pinterest standard event name.\"\n  },\n  {\n    \"type\": \"CHECKBOX\",\n    \"name\": \"overrideMode\",\n    \"displayName\": \"Event Data\",\n    \"checkboxText\": \"Override client data\",\n    \"simpleValueType\": true,\n    \"help\": \"If checked, you could override or set new values for parameters received from the Web container (client).\"\n  },\n  {\n    \"displayName\": \"Event Data\",\n    \"name\": \"serverEventDataListGroup\",\n    \"groupStyle\": \"ZIPPY_CLOSED\",\n    \"type\": \"GROUP\",\n    \"enablingConditions\": [\n      {\n        \"paramName\": \"overrideMode\",\n        \"type\": \"EQUALS\",\n        \"paramValue\": true\n      }\n    ],\n    \"subParams\": [\n      {\n        \"name\": \"serverEventDataList\",\n        \"simpleTableColumns\": [\n          {\n            \"valueValidators\": [\n              {\n                \"type\": \"NON_EMPTY\"\n              }\n            ],\n            \"defaultValue\": \"action_source\",\n            \"displayName\": \"Parameter Name\",\n            \"name\": \"name\",\n            \"isUnique\": true,\n            \"type\": \"SELECT\",\n            \"selectItems\": [\n              {\n                \"value\": \"action_source\",\n                \"displayValue\": \"Action Source\"\n              },\n              {\n                \"value\": \"event_time\",\n                \"displayValue\": \"Event Time\"\n              },\n              {\n                \"value\": \"event_id\",\n                \"displayValue\": \"Event ID\"\n              },\n              {\n                \"value\": \"event_source_url\",\n                \"displayValue\": \"Event Source URL\"\n              },\n              {\n                \"value\": \"opt_out\",\n                \"displayValue\": \"Opt Out\"\n              },\n              {\n                \"value\": \"partner_name\",\n                \"displayValue\": \"Partner Name\"\n              },\n              {\n                \"value\": \"app_id\",\n                \"displayValue\": \"App ID\"\n              },\n              {\n                \"value\": \"app_name\",\n                \"displayValue\": \"App name\"\n              },\n              {\n                \"value\": \"app_version\",\n                \"displayValue\": \"App version\"\n              },\n              {\n                \"value\": \"device_brand\",\n                \"displayValue\": \"Device brand\"\n              },\n              {\n                \"value\": \"device_carrier\",\n                \"displayValue\": \"Device carrier\"\n              },\n              {\n                \"value\": \"device_model\",\n                \"displayValue\": \"Device model\"\n              },\n              {\n                \"value\": \"device_type\",\n                \"displayValue\": \"Device type\"\n              },\n              {\n                \"value\": \"os_version\",\n                \"displayValue\": \"OS version\"\n              },\n              {\n                \"value\": \"wifi\",\n                \"displayValue\": \"WiFi\"\n              },\n              {\n                \"value\": \"language\",\n                \"displayValue\": \"Language\"\n              }\n            ]\n          },\n          {\n            \"defaultValue\": \"\",\n            \"displayName\": \"Parameter Value\",\n            \"name\": \"value\",\n            \"type\": \"TEXT\"\n          }\n        ],\n        \"type\": \"SIMPLE_TABLE\",\n        \"newRowButtonText\": \"Add Parameter\"\n      }\n    ]\n  },\n  {\n    \"displayName\": \"User Data\",\n    \"name\": \"userDataListGroup\",\n    \"groupStyle\": \"ZIPPY_CLOSED\",\n    \"type\": \"GROUP\",\n    \"enablingConditions\": [\n      {\n        \"paramName\": \"overrideMode\",\n        \"type\": \"EQUALS\",\n        \"paramValue\": true\n      }\n    ],\n    \"subParams\": [\n      {\n        \"name\": \"userDataList\",\n        \"simpleTableColumns\": [\n          {\n            \"valueValidators\": [\n              {\n                \"type\": \"NON_EMPTY\"\n              }\n            ],\n            \"defaultValue\": \"em\",\n            \"displayName\": \"Parameter Name\",\n            \"name\": \"name\",\n            \"isUnique\": true,\n            \"type\": \"SELECT\",\n            \"selectItems\": [\n              {\n                \"value\": \"em\",\n                \"displayValue\": \"Email\"\n              },\n              {\n                \"value\": \"ph\",\n                \"displayValue\": \"Phone\"\n              },\n              {\n                \"value\": \"ge\",\n                \"displayValue\": \"Gender\"\n              },\n              {\n                \"value\": \"db\",\n                \"displayValue\": \"Date of Birth\"\n              },\n              {\n                \"value\": \"ln\",\n                \"displayValue\": \"Last Name\"\n              },\n              {\n                \"value\": \"fn\",\n                \"displayValue\": \"First Name\"\n              },\n              {\n                \"value\": \"ct\",\n                \"displayValue\": \"City\"\n              },\n              {\n                \"value\": \"st\",\n                \"displayValue\": \"State\"\n              },\n              {\n                \"value\": \"zp\",\n                \"displayValue\": \"Zip\"\n              },\n              {\n                \"value\": \"country\",\n                \"displayValue\": \"Country\"\n              },\n              {\n                \"value\": \"hashed_maids\",\n                \"displayValue\": \"Maids\"\n              },\n              {\n                \"value\": \"client_ip_address\",\n                \"displayValue\": \"Client IP address\"\n              },\n              {\n                \"value\": \"client_user_agent\",\n                \"displayValue\": \"Client user agent\"\n              },\n              {\n                \"value\": \"external_id\",\n                \"displayValue\": \"External Id\"\n              },\n              {\n                \"value\": \"click_id\",\n                \"displayValue\": \"Click Id\"\n              }\n            ]\n          },\n          {\n            \"defaultValue\": \"\",\n            \"displayName\": \"Parameter Value\",\n            \"name\": \"value\",\n            \"type\": \"TEXT\"\n          }\n        ],\n        \"type\": \"SIMPLE_TABLE\",\n        \"newRowButtonText\": \"Add Parameter\"\n      }\n    ]\n  },\n  {\n    \"displayName\": \"Custom Data\",\n    \"name\": \"customDataListGroup\",\n    \"groupStyle\": \"ZIPPY_CLOSED\",\n    \"type\": \"GROUP\",\n    \"enablingConditions\": [\n      {\n        \"paramName\": \"overrideMode\",\n        \"type\": \"EQUALS\",\n        \"paramValue\": true\n      }\n    ],\n    \"subParams\": [\n      {\n        \"name\": \"customDataList\",\n        \"simpleTableColumns\": [\n          {\n            \"valueValidators\": [\n              {\n                \"type\": \"NON_EMPTY\"\n              }\n            ],\n            \"defaultValue\": \"currency\",\n            \"displayName\": \"Parameter Name\",\n            \"name\": \"name\",\n            \"isUnique\": true,\n            \"type\": \"SELECT\",\n            \"selectItems\": [\n              {\n                \"value\": \"currency\",\n                \"displayValue\": \"Currency\"\n              },\n              {\n                \"value\": \"value\",\n                \"displayValue\": \"Value\"\n              },\n              {\n                \"value\": \"content_name\",\n                \"displayValue\": \"Content Name\"\n              },\n              {\n                \"value\": \"content_category\",\n                \"displayValue\": \"Content Category\"\n              },\n              {\n                \"value\": \"content_brand\",\n                \"displayValue\": \"Content Brand\"\n              },\n              {\n                \"value\": \"content_ids\",\n                \"displayValue\": \"Content IDs\"\n              },\n              {\n                \"value\": \"contents\",\n                \"displayValue\": \"Contents\"\n              },\n              {\n                \"value\": \"num_items\",\n                \"displayValue\": \"Number of Items\"\n              },\n              {\n                \"value\": \"order_id\",\n                \"displayValue\": \"Order ID\"\n              },\n              {\n                \"value\": \"search_string\",\n                \"displayValue\": \"Search string\"\n              },\n              {\n                \"value\": \"opt_out_type\",\n                \"displayValue\": \"OptOutType\"\n              }\n            ]\n          },\n          {\n            \"defaultValue\": \"\",\n            \"displayName\": \"Parameter Value\",\n            \"name\": \"value\",\n            \"type\": \"TEXT\"\n          }\n        ],\n        \"type\": \"SIMPLE_TABLE\",\n        \"newRowButtonText\": \"Add Parameter\"\n      }\n    ]\n  },\n  {\n    \"type\": \"CHECKBOX\",\n    \"name\": \"testMode\",\n    \"displayName\": \"Test Mode\",\n    \"checkboxText\": \"Send as a test-request\",\n    \"simpleValueType\": true,\n    \"help\": \"If checked, the event will not be recorded but the API will still return the same response messages. Use this mode to verify your requests are working and your events are constructed correctly.\"\n  },\n  {\n    \"displayName\": \"Logs Settings\",\n    \"name\": \"logsGroup\",\n    \"groupStyle\": \"ZIPPY_OPEN\",\n    \"type\": \"GROUP\",\n    \"subParams\": [\n      {\n        \"type\": \"RADIO\",\n        \"name\": \"logMode\",\n        \"radioItems\": [\n          {\n            \"value\": \"log\",\n            \"displayValue\": \"Log to console\"\n          },\n          {\n            \"value\": \"donotlog\",\n            \"displayValue\": \"Do not log\"\n          }\n        ],\n        \"simpleValueType\": true,\n        \"defaultValue\": \"donotlog\"\n      }\n    ]\n  }\n]\n\n\n___SANDBOXED_JS_FOR_SERVER___\n\n// Sandbox Javascript imports\nconst getAllEventData = require('getAllEventData');\nconst getType = require('getType');\nconst sendHttpRequest = require('sendHttpRequest');\nconst JSON = require('JSON');\nconst Math = require('Math');\nconst getTimestampMillis = require('getTimestampMillis');\nconst sha256Sync = require('sha256Sync');\nconst getCookieValues = require('getCookieValues');\nconst setCookie = require('setCookie');\nconst parseUrl = require('parseUrl');\nconst makeInteger = require('makeInteger');\nconst makeString = require('makeString');\nconst logToConsole = require('logToConsole');\n\n\n// CONSTANTS\nconst isLogEnabled = isLoggingEnabled();\nconst eventModel = getAllEventData();\nif (isLogEnabled) logToConsole(JSON.stringify({'Tag Data': data}));\nif (isLogEnabled) logToConsole(JSON.stringify({'Event Data': eventModel}));\n\n// GA4 event names/types: https://support.google.com/analytics/answer/9267735\n// Pinterest event names/types: https://developers.pinterest.com/docs/api/v5/#operation/events/create\nconst EVENT_NAME_MAPPINGS = {\n  \"add_to_cart\": \"add_to_cart\",\n  \"addtocart\": \"add_to_cart\",\n  \"purchase\": \"checkout\",\n  \"buy\": \"checkout\",\n  \"pay\": \"checkout\",\n  \"payment\": \"checkout\",\n  \"generate_lead\": \"lead\",\n  \"submit_application\": \"lead\",\n  \"contact\": \"lead\",\n  \"page_view\": \"page_visit\",\n  \"pageview\": \"page_visit\",\n  \"pagevisit\": \"page_visit\",\n  \"gtm.dom\": \"page_visit\",\n  \"search\": \"search\",\n  \"find_location\": \"search\",\n  \"sign_up\": \"signup\",\n  \"signup\": \"signup\",\n  \"completeregistration\": \"signup\",\n  \"viewcategory\": \"view_category\",\n  \"viewcontent\": \"view_category\",\n  \"view_item_list\": \"view_category\",\n  \"watchvideo\": \"watch_video\",\n  \"add_payment_info\": \"custom\",\n  \"add_shipping_info\": \"custom\",\n  \"add_to_wishlist\": \"custom\",\n  \"begin_checkout\": \"custom\",\n  \"refund\": \"custom\",\n  \"remove_from_cart\": \"custom\",\n  \"select_item\": \"custom\",\n  \"select_promotion\": \"custom\",\n  \"view_cart\": \"custom\",\n  \"view_item\": \"page_visit\",\n  \"view_promotion\": \"custom\"\n};\n\nconst PARAM_VALUE_FORMAT = {\n  \"event_time\": \"integer\",\n  \"event_id\": \"string\",\n  \"num_items\": \"integer\",\n  \"opt_out\": \"boolean\",\n  \"wifi\": \"boolean\",\n  \"value\": \"string\",\n  \"em\": \"array-hashed\",\n  \"ph\": \"array-hashed\",\n  \"ge\": \"array-hashed\",\n  \"db\": \"array-hashed\",\n  \"fn\": \"array-hashed\",\n  \"ln\": \"array-hashed\",\n  \"ct\": \"array-hashed\",\n  \"st\": \"array-hashed\",\n  \"zp\": \"array-hashed\",\n  \"country\": \"array-hashed\",\n  \"hashed_maids\": \"array-hashed\",\n  \"external_id\": \"array-hashed\",\n  \"content_ids\": \"array\",\n  \"contents\": \"json\"\n};\n\nconst DEFAULT_NAMED_PARTNER = 'ss-gtm';\n\nconst DEFAULT_ACTION_SOURCE = 'web';\n\nconst DEFAULT_EVENT_TIME = Math.round(getTimestampMillis() / 1000);\n\nconst DEFAULT_CLIENT_IP_ADDRESS = eventModel.ip_override;\n\nconst DEFAULT_CLIENT_USER_AGENT = eventModel.user_agent;\n\n// FUNCTIONS\nfunction isAlreadyHashed(input) {\n  return input && (input.match('^[A-Fa-f0-9]{64}$') != null);\n}\n\nfunction hashFunction(input) {\n  const type = getType(input);\n\n  if (type == 'undefined' || input == 'undefined') {\n    return undefined;\n  }\n\n  if (input == null || isAlreadyHashed(input)) {\n    return input;\n  }\n\n  return sha256Sync(input.trim().toLowerCase(), {outputEncoding: 'hex'});\n}\n\nfunction getContentsFromItems(items) {\n    return items.map(item => {\n        return {\n            \"id\": makeString((item.item_id) ? item.item_id : item.item_name),\n            \"item_price\": makeString(item.price),\n            \"quantity\": makeInteger(item.quantity),\n        };\n    });\n}\n\nfunction getContentIdsFromItems(items) {\n    return JSON.stringify(items.map(item => {\n        return makeString((item.item_id) ? item.item_id : item.item_name);\n    }));\n}\n\nfunction getPinterestEventName(gtmEventName, toLowerCase) {\n  let pinterestEventName;\n  if (data.eventName === 'inherit') {\n    if (toLowerCase) {\n      gtmEventName = gtmEventName.trim().toLowerCase();\n    }\n    pinterestEventName = EVENT_NAME_MAPPINGS[gtmEventName] || gtmEventName;\n  } else if ( data.eventName === 'pinterestEventName') {\n    pinterestEventName = data.eventNameStandard;\n  }\n  return pinterestEventName;\n}\n\nfunction replaceAll(string, search, replace) {\n  return string.split(search).join(replace);\n}\n\nfunction convertToArrayOfStrings(input, hashIfNeeded) {\n  if (input == null) {\n    return input;\n  }\n\n  const type = getType(input);\n  if (type == 'undefined' || input == 'undefined') {\n    return undefined;\n  }\n\n  let arrayOfStrings = [];\n  if (type == 'array') {\n    arrayOfStrings = input.map((i) => makeString(i));\n  }\n  if (type == 'string') {\n    let arrayOfObjs = replaceAll(input.toString().replace('[','').replace(']',''),'\\\"','').split(',');\n    arrayOfStrings = arrayOfObjs.map((i) => makeString(i).trim()).filter(function(e) {\n      return !(!e || e.length === 0 );\n    });\n  }\n\n  return arrayOfStrings.map(item => {\n    if (hashIfNeeded === true) {\n      return hashFunction(item);\n    }\n    return item;\n  });\n}\n\nfunction getBooleanFromString(input) {\n  const type = getType(input);\n  if (type == 'undefined' || input == 'undefined') {\n    return undefined;\n  }\n\n  if (input == null) {\n    return input;\n  }\n\n  return (typeof input === 'string' && (input.toLowerCase() === \"true\" || input.toLowerCase() === \"false\")) ? JSON.parse(input.toLowerCase()) : input;\n}\n\nfunction getJsonFromString(input) {\n  const type = getType(input);\n  if (type == 'undefined' || input == 'undefined') {\n    return undefined;\n  }\n\n  if (input == null) {\n    return input;\n  }\n\n  return (typeof input === 'string' && input.charAt(0) === '[' && input.charAt(input.length - 1) === ']' \n          && input.charAt(1) === '{' && input.charAt(input.length - 2) === '}') ? JSON.parse(input) : input;\n}\n\nfunction overrideEventData(event, data) {\n  if (data.serverEventDataList) {\n    data.serverEventDataList.forEach(d => {\n      event[d.name] = d.value;\n    });\n  }\n  if (data.userDataList) {\n    data.userDataList.forEach(d => {\n      event.user_data[d.name] = d.value;\n    });\n  }\n  if (data.customDataList) {\n    data.customDataList.forEach(d => {\n      event.custom_data[d.name] = d.value;\n    });\n  }\n}\n\nfunction formatDataTypes(object) {\n  for (let key in object) {\n    if (object.hasOwnProperty(key)) {\n        if (PARAM_VALUE_FORMAT[key] === 'string') object[key] = makeString(object[key]);\n        if (PARAM_VALUE_FORMAT[key] === 'integer') object[key] = makeInteger(JSON.parse(object[key]));\n        if (PARAM_VALUE_FORMAT[key] === 'boolean') object[key] = getBooleanFromString(object[key]);\n        if (PARAM_VALUE_FORMAT[key] === 'array') object[key] = convertToArrayOfStrings(object[key], false);\n        if (PARAM_VALUE_FORMAT[key] === 'array-hashed') object[key] = convertToArrayOfStrings(object[key], true);\n        if (PARAM_VALUE_FORMAT[key] === 'json') object[key] = getJsonFromString(object[key]);\n    }\n  }\n}\n\nfunction isLoggingEnabled() {\n  return (data.logMode === 'log') ? true : false;\n}\n\n// EVENT PARAMETERS\nconst event = {};\n// event_name\nevent.event_name = getPinterestEventName(eventModel.event_name, true);\n// action_source\nevent.action_source = eventModel.action_source ? eventModel.action_source : DEFAULT_ACTION_SOURCE;\n// event_time\nevent.event_time = eventModel.event_time ? eventModel.event_time : DEFAULT_EVENT_TIME;\n// event_id\nif (eventModel.event_id) {\n  event.event_id = eventModel.event_id;\n}\n// event_source_url\nevent.event_source_url = eventModel.event_source_url ? eventModel.event_source_url : eventModel.page_location;\n// opt_out\nif (eventModel.opt_out) {\n  event.opt_out = eventModel.opt_out;\n}\n// partner_name\nif (eventModel.partner_name) {\n  event.partner_name = eventModel.partner_name;\n}\n\n// AUTHORIZATION PARAMETERS\nconst apiAccessToken = data.apiAccessToken;\n\n// USER PARAMETERS (user_data)\nevent.user_data = {};\nif (eventModel.user_data != null) {\n  // em\n  if (eventModel.user_data.email_address) {\n    event.user_data.em = eventModel.user_data.email_address;\n  }\n  // ph\n  if (eventModel.user_data.phone_number) {\n    event.user_data.ph = eventModel.user_data.phone_number;\n  }\n  // ge\n  if (eventModel.user_data.gender) {\n    event.user_data.ge = eventModel.user_data.gender;\n  }\n  // db\n  if (eventModel.user_data.date_of_birth) {\n    event.user_data.db = eventModel.user_data.date_of_birth;\n  }\n\n  if (eventModel.user_data.address != null) {\n    const addressData = eventModel.user_data.address;\n    // fn\n    event.user_data.fn = addressData.first_name;\n    // ln\n    event.user_data.ln = addressData.last_name;\n    // ct\n    event.user_data.ct = addressData.city;\n    // st\n    event.user_data.st = addressData.region;\n    // zp\n    event.user_data.zp = addressData.postal_code;\n    // country\n    event.user_data.country = addressData.country;\n  }\n  // hashed_maids\n  if (eventModel.user_data.hashed_maids) {\n    event.user_data.hashed_maids = eventModel.user_data.hashed_maids;\n  }\n  // external_id\n  if (eventModel.user_data.external_id) {\n    event.user_data.external_id = eventModel.user_data.external_id;\n  }\n  // click_id\n  if (eventModel.user_data.click_id) {\n    event.user_data.click_id = eventModel.user_data.click_id;\n  }\n}\n\n// client_ip_address / default\nevent.user_data.client_ip_address = (eventModel.user_data && eventModel.user_data.client_ip_address) ? eventModel.user_data.client_ip_address : DEFAULT_CLIENT_IP_ADDRESS;\n// client_user_agent / default\nevent.user_data.client_user_agent = (eventModel.user_data && eventModel.user_data.client_user_agent) ? eventModel.user_data.client_user_agent : DEFAULT_CLIENT_USER_AGENT;\n\n// CUSTOM PARAMETERS (custom_data)\nevent.custom_data = {};\n// currency\nif (eventModel.currency) {\n  event.custom_data.currency = eventModel.currency;\n}\n// value\nif (eventModel.value) {\n  event.custom_data.value = eventModel.value;\n}\n// content_name\nif (eventModel.content_name) {\n  event.custom_data.content_name = eventModel.content_name;\n}\n// content_category\nif (eventModel.content_category) {\n  event.custom_data.content_category = eventModel.content_category;\n}\n// content_brand\nif (eventModel.content_brand) {\n  event.custom_data.content_brand = eventModel.content_brand;\n}\n// content_ids\nif (eventModel.content_ids) {\n  event.custom_data.content_ids = eventModel.content_ids;\n} else if (eventModel.items) {\n  event.custom_data.content_ids = getContentIdsFromItems(eventModel.items);\n}\n// contents\nif (eventModel.contents) {\n  event.custom_data.contents = eventModel.contents;\n} else if (eventModel.items) {\n  event.custom_data.contents = getContentsFromItems(eventModel.items);\n}\n// num_items\nif (eventModel.num_items) {\n  event.custom_data.num_items = eventModel.num_items;\n} else if (eventModel.items) {\n  event.custom_data.num_items = eventModel.items.length;\n}\n// order_id\nif (eventModel.order_id) {\n  event.custom_data.order_id = eventModel.order_id;\n}\n// search_string\nif (eventModel.search_string) {\n  event.custom_data.search_string = eventModel.search_string;\n}\n// opt_out_type\nif (eventModel.opt_out_type) {\n  event.custom_data.opt_out_type = eventModel.opt_out_type;\n}\n// app_id\nif (eventModel.app_id) {\n  event.app_id = eventModel.app_id;\n}\n// app_name\nif (eventModel.app_name) {\n  event.app_name = eventModel.app_name;\n}\n// app_version\nif (eventModel.app_version) {\n  event.app_version = eventModel.app_version;\n}\n// device_brand\nif (eventModel.device_brand) {\n  event.device_brand = eventModel.device_brand;\n}\n// device_carrier\nif (eventModel.device_carrier) {\n  event.device_carrier = eventModel.device_carrier;\n}\n// device_model\nif (eventModel.device_model) {\n  event.device_model = eventModel.device_model;\n}\n// device_type\nif (eventModel.device_type) {\n  event.device_type = eventModel.device_type;\n}\n// os_version\nif (eventModel.os_version) {\n  event.os_version = eventModel.os_version;\n}\n// wifi\nif (eventModel.wifi) {\n  event.wifi = eventModel.wifi;\n}\n// language\nif (eventModel.language) {\n  event.language = eventModel.language.slice(0,2);\n}\n\n// np\nevent.custom_data.np = DEFAULT_NAMED_PARTNER;\n\n// OVERRIDE EVENT DATA\nif (data.overrideMode) {\n  overrideEventData(event, data);\n}\n\n// ENSURE CORRECT FORMAT\nformatDataTypes(event);\nif (event.user_data) formatDataTypes(event.user_data);\nif (event.custom_data) formatDataTypes(event.custom_data);\n\n// PINTEREST API ENDPOINT\nconst API_ENDPOINT = 'https://api.pinterest.com/v5/ad_accounts/';\nvar requestEndpoint = [API_ENDPOINT, data.advertiserId, '/events'].join('');\nif (data.testMode) {\n  requestEndpoint = [requestEndpoint,'?test=true'].join('');\n}\nconst eventRequest = {data: [event]};\nif (isLogEnabled) {\n  logToConsole(JSON.stringify({\n    'Name': 'Pinterest Conversions API',\n    'Type': 'Request',\n    'RequestMethod': 'POST',\n    'RequestUrl': requestEndpoint,\n    'AdvertiserId': data.advertiserId,\n    'EventName': event.event_name,\n    'RequestBody (payload)': eventRequest\n  }));\n}\n\n// Posting to Pinterest Conversions API endpoint\nconst requestHeaders = {\n  headers: {'content-type': 'application/json',\n            'Authorization':'Bearer ' + apiAccessToken},\n  method: 'POST'};\n\nsendHttpRequest(requestEndpoint,(responseStatusCode, responseHeaders, responseBody) => {\n  if (isLogEnabled) {\n    logToConsole(JSON.stringify({\n      'Name': 'Pinterest Conversions API',\n      'Type': 'Response',\n      'AdvertiserId': data.advertiserId,\n      'EventName': event.event_name,\n      'ResponseStatusCode': responseStatusCode,\n      'ResponseHeaders': responseHeaders,\n      'ResponseBody': responseBody\n    }));\n  }\n  if (responseStatusCode >= 200 && responseStatusCode < 300) {\n      data.gtmOnSuccess();\n    } else {\n      data.gtmOnFailure();\n    }\n  },\n  requestHeaders,\n  JSON.stringify(eventRequest)\n);\n\n\n___SERVER_PERMISSIONS___\n\n[\n  {\n    \"instance\": {\n      \"key\": {\n        \"publicId\": \"read_event_data\",\n        \"versionId\": \"1\"\n      },\n      \"param\": [\n        {\n          \"key\": \"eventDataAccess\",\n          \"value\": {\n            \"type\": 1,\n            \"string\": \"any\"\n          }\n        }\n      ]\n    },\n    \"clientAnnotations\": {\n      \"isEditedByUser\": true\n    },\n    \"isRequired\": true\n  },\n  {\n    \"instance\": {\n      \"key\": {\n        \"publicId\": \"send_http\",\n        \"versionId\": \"1\"\n      },\n      \"param\": [\n        {\n          \"key\": \"allowedUrls\",\n          \"value\": {\n            \"type\": 1,\n            \"string\": \"specific\"\n          }\n        },\n        {\n          \"key\": \"urls\",\n          \"value\": {\n            \"type\": 2,\n            \"listItem\": [\n              {\n                \"type\": 1,\n                \"string\": \"https://api.pinterest.com/\"\n              }\n            ]\n          }\n        }\n      ]\n    },\n    \"clientAnnotations\": {\n      \"isEditedByUser\": true\n    },\n    \"isRequired\": true\n  },\n  {\n    \"instance\": {\n      \"key\": {\n        \"publicId\": \"get_cookies\",\n        \"versionId\": \"1\"\n      },\n      \"param\": [\n        {\n          \"key\": \"cookieAccess\",\n          \"value\": {\n            \"type\": 1,\n            \"string\": \"specific\"\n          }\n        },\n        {\n          \"key\": \"cookieNames\",\n          \"value\": {\n            \"type\": 2,\n            \"listItem\": [\n              {\n                \"type\": 1,\n                \"string\": \"_pinterest_sess\"\n              },\n              {\n                \"type\": 1,\n                \"string\": \"_pinterest_ct\"\n              },\n              {\n                \"type\": 1,\n                \"string\": \"_pinterest_ct_rt\"\n              },\n              {\n                \"type\": 1,\n                \"string\": \"_epik\"\n              },\n              {\n                \"type\": 1,\n                \"string\": \"_derived_epik\"\n              },\n              {\n                \"type\": 1,\n                \"string\": \"_pin_unauth\"\n              },\n              {\n                \"type\": 1,\n                \"string\": \"_pinterest_ct_ua\"\n              },\n              {\n                \"type\": 1,\n                \"string\": \"_routing_id\"\n              }\n            ]\n          }\n        }\n      ]\n    },\n    \"clientAnnotations\": {\n      \"isEditedByUser\": true\n    },\n    \"isRequired\": true\n  },\n  {\n    \"instance\": {\n      \"key\": {\n        \"publicId\": \"set_cookies\",\n        \"versionId\": \"1\"\n      },\n      \"param\": [\n        {\n          \"key\": \"allowedCookies\",\n          \"value\": {\n            \"type\": 2,\n            \"listItem\": [\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_pinterest_sess\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              },\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_pinterest_ct\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              },\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_pinterest_ct_rt\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              },\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_epik\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              },\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_derived_epik\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              },\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_pin_unauth\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              },\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_pinterest_ct_ua\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              },\n              {\n                \"type\": 3,\n                \"mapKey\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"name\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"domain\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"path\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"secure\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"session\"\n                  }\n                ],\n                \"mapValue\": [\n                  {\n                    \"type\": 1,\n                    \"string\": \"_routing_id\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"*\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  },\n                  {\n                    \"type\": 1,\n                    \"string\": \"any\"\n                  }\n                ]\n              }\n            ]\n          }\n        }\n      ]\n    },\n    \"clientAnnotations\": {\n      \"isEditedByUser\": true\n    },\n    \"isRequired\": true\n  },\n  {\n    \"instance\": {\n      \"key\": {\n        \"publicId\": \"logging\",\n        \"versionId\": \"1\"\n      },\n      \"param\": [\n        {\n          \"key\": \"environments\",\n          \"value\": {\n            \"type\": 1,\n            \"string\": \"all\"\n          }\n        }\n      ]\n    },\n    \"clientAnnotations\": {\n      \"isEditedByUser\": true\n    },\n    \"isRequired\": true\n  }\n]\n\n\n___TESTS___\n\nscenarios:\n- name: On EventModel model data tag triggers to send to Pinterest Conversions API\n    (cAPI)\n  code: |-\n    // Act\n    runCode(testConfigurationData);\n\n    //Assert\n    assertApi('sendHttpRequest').wasCalledWith(requestEndpoint, actualSuccessCallback, requestHeaderOptions, JSON.stringify(requestData));\n    assertApi('gtmOnSuccess').wasCalled();\n- name: On sending 'action_source' from Client, Tag overrides the preset configuration\n    from server side\n  code: |-\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.action_source = testData.action_source;\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].action_source).isEqualTo(testConfigurationData.serverEventDataList[testConfigurationData.serverEventDataList.map(o => o.name).indexOf('action_source')].value);\n- name: On not sending 'action_source' from Client, Tag set 'web' as a default value\n    for cAPI\n  code: |-\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.action_source = null;\n      return inputEventModel;\n    });\n    testConfigurationData.serverEventDataList = null;\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].action_source).isEqualTo(DEFAULT_ACTION_SOURCE);\n- name: On receiving 'event_name', Tag trims and lowercases it to support case insensitive\n  code: |-\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.event_name = ' Add_to_Cart ';\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].event_name).isEqualTo('add_to_cart');\n- name: On receiving 'event_name', Tag tries to map it to a standard event name\n  code: |-\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.event_name = 'purchase';\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].event_name).isEqualTo('checkout');\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.event_name = ' PAGE_VIEW';\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].event_name).isEqualTo('page_visit');\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.event_name = 'view_cart';\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].event_name).isEqualTo('custom');\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.event_name = ' ANY_other_Name ';\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].event_name).isEqualTo('any_other_name');\n- name: On receiving event data, Tag hashes the 'user_data' fields if they are not\n    already hashed\n  code: |-\n    // Un-hashed raw email_address from Common Event Schema is hashed before posted to Conversions API.\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.user_data = {};\n      inputEventModel.user_data.email_address = '[foo1@bar.com,foo2@bar.com]';\n      inputEventModel.user_data.phone_number = 'c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646';\n      inputEventModel.user_data.gender = \" m \";\n      inputEventModel.user_data.hashed_maids = [\"maid_01\", \"6ab15588d5535128752e63d57e2e216234e9633c6397cdcc98f4976b53d2a381\"];\n      inputEventModel.user_data.address = {};\n      inputEventModel.user_data.address.first_name = 'Foo';\n      inputEventModel.user_data.address.last_name = \"[Bar]\";\n      inputEventModel.user_data.address.city = 'Menlo Park';\n      inputEventModel.user_data.address.region = 'ca';\n      inputEventModel.user_data.address.postal_code = '5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5';\n      inputEventModel.user_data.address.country = ['usa'];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].user_data.em).isEqualTo([hashFunction('foo1@bar.com'),hashFunction('foo2@bar.com')]);\n    assertThat(JSON.parse(httpBody).data[0].user_data.ph).isEqualTo([\"c775e7b757ede630cd0aa1113bd102661ab38829ca52a6422ab782862f268646\"]);\n    assertThat(JSON.parse(httpBody).data[0].user_data.ge).isEqualTo(hashFunction('m').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.hashed_maids).isEqualTo([hashFunction('maid_01'),\"6ab15588d5535128752e63d57e2e216234e9633c6397cdcc98f4976b53d2a381\"]);\n    assertThat(JSON.parse(httpBody).data[0].user_data.fn).isEqualTo(hashFunction('Foo').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.ln).isEqualTo(hashFunction('Bar').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.ct).isEqualTo(hashFunction('Menlo Park').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.st).isEqualTo(hashFunction('ca').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.zp).isEqualTo([\"5994471abb01112afcc18159f6cc74b4f511b99806da59b3caf5a9c173cacfc5\"]);\n    assertThat(JSON.parse(httpBody).data[0].user_data.country).isEqualTo(hashFunction('usa').split());\n\n    // Un-hashed raw email_address in mixed-case is converted to lowercase, hashed and posted to Conversions API.\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.user_data.email_address = 'FOO@BAR.com';\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].user_data.em).isEqualTo(hashFunction('foo@bar.com').split());\n\n\n    // Already sha256(email_address) field from GA4 schema, is unchanged, is posted as-is to Conversions API.\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.user_data.email_address = hashFunction('foo@bar.com');\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].user_data.em).isEqualTo(hashFunction('foo@bar.com').split());\n\n    // Already null email field from GA4 schema, is sent as null to Conversions API.\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.user_data.email_address = null;\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].user_data.em).isUndefined();\n- name: When some 'user_data' params are missing, Tag skips parsing the nested fields\n  code: |\n    mock('getAllEventData', () => {\n      inputEventModel.user_data = {};\n      inputEventModel.user_data.email_address = 'foo@bar.com';\n      inputEventModel.user_data.phone_number = '1234567890';\n      return inputEventModel;\n    });\n\n    runCode(testConfigurationData);\n\n    assertThat(JSON.parse(httpBody).data[0].user_data.em).isEqualTo(hashFunction('foo@bar.com').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.ph).isEqualTo(hashFunction('1234567890').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.fn).isUndefined();\n    assertThat(JSON.parse(httpBody).data[0].user_data.ln).isUndefined();\n    assertThat(JSON.parse(httpBody).data[0].user_data.ct).isUndefined();\n    assertThat(JSON.parse(httpBody).data[0].user_data.st).isUndefined();\n    assertThat(JSON.parse(httpBody).data[0].user_data.zp).isUndefined();\n    assertThat(JSON.parse(httpBody).data[0].user_data.country).isUndefined();\n- name: When some 'user_data' params are undefined, Tag skips parsing them\n  code: |\n    mock('getAllEventData', () => {\n      inputEventModel.user_data = {};\n      inputEventModel.user_data.email_address = undefined;\n      inputEventModel.user_data.phone_number = '1234567890';\n      inputEventModel.user_data.address = {};\n      inputEventModel.user_data.address.first_name = 'John';\n      inputEventModel.user_data.address.last_name = undefined;\n      inputEventModel.user_data.address.city = 'menlopark';\n      inputEventModel.user_data.address.region = 'ca';\n      inputEventModel.user_data.address.postal_code = '94025';\n      inputEventModel.user_data.address.country = 'usa';\n      return inputEventModel;\n    });\n\n    runCode(testConfigurationData);\n\n    assertThat(JSON.parse(httpBody).data[0].user_data.em).isUndefined();\n    assertThat(JSON.parse(httpBody).data[0].user_data.ph).isEqualTo(hashFunction('1234567890').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.fn).isEqualTo(hashFunction('John').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.ln).isUndefined();\n    assertThat(JSON.parse(httpBody).data[0].user_data.ct).isEqualTo(hashFunction('menlopark').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.st).isEqualTo(hashFunction('ca').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.zp).isEqualTo(hashFunction('94025').split());\n    assertThat(JSON.parse(httpBody).data[0].user_data.country).isEqualTo(hashFunction('usa').split());\n- name: On receiving 'value' as number, Tag converts it to String format\n  code: |\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.value = 12.45;\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.value).isEqualTo(\"12.45\");\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.value = '12.45';\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.value).isEqualTo(\"12.45\");\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.value = 12;\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.value).isEqualTo(\"12\");\n- name: On receiving 'content_ids' with different formats, Tag transforms it to an\n    Array of Strings\n  code: |-\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = [\"id_1\",\"id_2\"];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isEqualTo([\"id_1\",\"id_2\"]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = [1, 2, 3];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isEqualTo([\"1\",\"2\",\"3\"]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = [\"1\", 2.5, \"3.10\"];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isEqualTo([\"1\",\"2.5\",\"3.10\"]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = \"[1 , 2.5, 3]\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isEqualTo([\"1\",\"2.5\",\"3\"]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = \"[\\\"1\\\" , 2.5, \\\"3\\\"]\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isEqualTo([\"1\",\"2.5\",\"3\"]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = \"[1 , , 3]\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isEqualTo([\"1\",\"3\"]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = \"  \";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isEqualTo([]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = \"\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isUndefined();\n\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.content_ids = null;\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.content_ids).isUndefined();\n- name: On receiving 'contents' with different formats, Tag transforms it to a valid\n    Json object if feasible\n  code: |-\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = [{\"id\":\"value\"}];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id\":\"value\"}]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = [\"id_1\",\"id_2\"];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([\"id_1\",\"id_2\"]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = \"[\\\"id_1\\\",\\\"id_2\\\"]\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo(\"[\\\"id_1\\\",\\\"id_2\\\"]\");\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = \"[{\\\"id_1\\\":\\\"value_1\\\"},{\\\"id_2\\\":\\\"value_2\\\"}]\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id_1\":\"value_1\"},{\"id_2\":\"value_2\"}]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = [{\"id\":\"id01\",\"item_price\":\"12.4\",\"quantity\":12}];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id\":\"id01\",\"item_price\":\"12.4\",\"quantity\":12}]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = \"[{\\\"id\\\":\\\"id01\\\",\\\"item_price\\\":\\\"12.4\\\",\\\"quantity\\\":12}]\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id\":\"id01\",\"item_price\":\"12.4\",\"quantity\":12}]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = \"\";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isUndefined();\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = null;\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isUndefined();\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = \" \";\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo(\" \");\n- name: On receiving 'items' from GA4 event, Tag parses them into 'contents' for cAPI\n  code: |\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = null;\n      inputEventModel.items = [{item_id: 10, price: 12.4, quantity: 2}];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id\":\"10\",\"item_price\":\"12.4\",\"quantity\":2}]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = undefined;\n      inputEventModel.items = [{item_id: \"id-01\", \"price\": \"12.4\", quantity: 2}];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id\":\"id-01\",\"item_price\":\"12.4\",\"quantity\":2}]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = undefined;\n      inputEventModel.items = [{item_name: \"shoes\", price: 0, \"quantity\": \"2\"}];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id\":\"shoes\",\"item_price\":\"0\",\"quantity\":2}]);\n\n    // Act\n    mock('getAllEventData', () => {\n      inputEventModel.contents = undefined;\n      inputEventModel.items = [{item_id: 5, item_name: \"shoes\", price: 0, \"quantity\": \"2\"},{item_name: \"item_01\", price: 12.5, \"quantity\": \"3\"}];\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents).isEqualTo([{\"id\":\"5\",\"item_price\":\"0\",\"quantity\":2},{\"id\":\"item_01\",\"item_price\":\"12.5\",\"quantity\":3}]);\n- name: On receiving 'items' from GA4 event, Tag parses them into 'content_ids', 'contents'\n    and 'num_items' for cAPI\n  code: |\n    // Act\n    let items = [\n      {\n        item_id: '1',\n        item_name: 'item_1',\n        quantity: 5,\n        price: 123.45,\n        item_category: 'cat_1',\n        item_brand: 'brand_1',\n      },\n      {\n        item_id: '2',\n        item_name: 'item_2',\n        quantity: 10,\n        price: 123.45,\n        item_category: 'cat_2',\n        item_brand: 'brand_2',\n      }\n    ];\n    mock('getAllEventData', () => {\n      inputEventModel.contents = null;\n      inputEventModel.content_ids = null;\n      inputEventModel.num_items = null;\n      inputEventModel.items = items;\n      return inputEventModel;\n    });\n    runCode(testConfigurationData);\n\n    //Assert\n    let actual_contents = JSON.parse(httpBody).data[0].custom_data.contents;\n    let actual_content_ids = JSON.parse(httpBody).data[0].custom_data.content_ids;\n    for( var i = 0; i < items.length; i++) {\n      // contents\n      assertThat(actual_contents[i].id).isEqualTo(makeString(items[i].item_id));\n      assertThat(actual_contents[i].item_price).isEqualTo(makeString(items[i].price));\n      assertThat(actual_contents[i].quantity).isEqualTo(makeInteger(items[i].quantity));\n      // content_ids\n      assertThat(actual_content_ids[i]).isEqualTo(makeString((items[i].item_id) ? items[i].item_id : items[i].item_name));\n    }\n    // num_items\n    let actual_num_items = JSON.parse(httpBody).data[0].custom_data.num_items;\n    assertThat(JSON.parse(httpBody).data[0].custom_data.contents.length).isEqualTo(items.length);\nsetup: |-\n  // Arrange\n  const JSON = require('JSON');\n  const Math = require('Math');\n  const getTimestampMillis = require('getTimestampMillis');\n  const sha256Sync = require('sha256Sync');\n  const makeInteger = require('makeInteger');\n  const makeString = require('makeString');\n  const logToConsole = require('logToConsole');\n  const DEFAULT_NAMED_PARTNER = 'ss-gtm';\n  const DEFAULT_ACTION_SOURCE = 'web';\n\n  // helper methods\n  function hashFunction(input) {\n    return sha256Sync(input.trim().toLowerCase(), {outputEncoding: 'hex'});\n  }\n\n  const testConfigurationData = {\n    advertiserId: \"123\",\n    apiAccessToken: \"token\",\n    eventName: \"inherit\",\n    overrideMode: true,\n    serverEventDataList:[{name: \"action_source\", value: \"serverWebsite\"}]\n  };\n\n  const testData = {\n    event_name: \"add_to_cart\",\n    action_source: \"web\",\n    event_time: \"1679414563\",\n    event_id: \"eventId001\",\n    opt_out: \"true\",\n    user_data: {\n      email_address: \"web@test.com\",\n      phone_number: \"123456789\",\n      gender: \"m\",\n      date_of_birth: \"19910526\",\n      first_name: \"mirko\",\n      last_name: \"rodriguez\",\n      city: \"menlopark\",\n      state: \"ca\",\n      country: \"us\",\n      hashed_maids: \"EA7583CD-A667-48BC-B806-42ECB2B48606\",\n      zip: \"12345\",\n      external_id: \"cdda802e-fb9c-47ad-9866-0794d394c912\",\n      ip_address: \"216.3.128.12\",\n      user_agent: \"Test_UA\",\n      click_id: \"dj0yJnU9b2JDcFFHekV4SHJNcmVrbFBkUEdqakh0akdUT1VjVVUmcD0yJm49cnNBQ3F2Q2dOVDBXWWhkWklrUGxBUSZ0PUFBQUFBR1BaY3Bv\"\n    },\n    //custom_data\n    currency: \"USD\",\n    value: \"123\",\n    content_name: \"pinterest-themed-clothing\",\n    content_category: \"shirts\",\n    content_brand: \"pinterest-brand\",\n    content_ids: [\"id_01\", \"id_02\"],\n    contents:  [{\"id\": \"id_01\", \"item_price\": \"12.4\", \"quantity\": 2}, {\"id\": \"id_02\", \"item_price\": \"14.2\", \"quantity\": 3}],\n    num_items: \"5\",\n    order_id: \"order_id\",\n    search_string: \"shoes\",\n    opt_out_type: \"LDP\",\n    language: \"en\"\n  };\n\n  let inputEventModel = {\n    \"event_name\": testData.event_name,\n    \"action_source\": testData.action_source,\n    \"event_time\": testData.event_time,\n    \"event_id\": testData.event_id,\n    \"opt_out\": testData.opt_out,\n    \"user_data\": {\n      \"email_address\": testData.user_data.email_address,\n      \"phone_number\": testData.user_data.phone_number,\n      \"gender\": testData.user_data.gender,\n      \"date_of_birth\": testData.user_data.date_of_birth,\n      \"address\": {\n        \"first_name\": testData.user_data.first_name,\n        \"last_name\": testData.user_data.last_name,\n        \"city\": testData.user_data.city,\n        \"region\": testData.user_data.state,\n        \"postal_code\": testData.user_data.zip,\n        \"country\": testData.user_data.country\n      },\n      \"hashed_maids\": testData.user_data.hashed_maids,\n      \"external_id\": testData.user_data.external_id,\n      \"click_id\": testData.user_data.click_id\n    },\n    \"ip_override\": testData.user_data.ip_address,\n    \"user_agent\": testData.user_data.user_agent,\n    //custom_data\n    \"currency\": testData.currency,\n    \"value\": testData.value,\n    \"content_name\": testData.content_name,\n    \"content_category\": testData.content_category,\n    \"content_brand\": testData.content_brand,\n    \"content_ids\": testData.content_ids,\n    \"contents\": testData.contents,\n    \"num_items\": testData.num_items,\n    \"order_id\": testData.order_id,\n    \"search_string\": testData.search_string,\n    \"opt_out_type\": testData.opt_out_type,\n    \"language\": testData.language\n  };\n\n  const expectedEventData = {\n  \"event_name\": testData.event_name.trim().toLowerCase(),\n  \"action_source\": testConfigurationData.serverEventDataList[testConfigurationData.serverEventDataList.map(o => o.name).indexOf('action_source')].value,\n  \"event_time\": makeInteger(testData.event_time),\n  \"event_id\": testData.event_id,\n  \"opt_out\": JSON.parse(testData.opt_out),\n  \"user_data\": {\n    \"em\": hashFunction(testData.user_data.email_address).split(),\n    \"ph\": hashFunction(testData.user_data.phone_number).split(),\n    \"ge\": hashFunction(testData.user_data.gender).split(),\n    \"db\": hashFunction(testData.user_data.date_of_birth).split(),\n    \"fn\": hashFunction(testData.user_data.first_name).split(),\n    \"ln\": hashFunction(testData.user_data.last_name).split(),\n    \"ct\": hashFunction(testData.user_data.city).split(),\n    \"st\": hashFunction(testData.user_data.state).split(),\n    \"zp\": hashFunction(testData.user_data.zip).split(),\n    \"country\": hashFunction(testData.user_data.country).split(),\n    \"hashed_maids\": hashFunction(testData.user_data.hashed_maids).split(),\n    \"external_id\": hashFunction(testData.user_data.external_id).split(),\n    \"click_id\": testData.user_data.click_id,\n    \"client_ip_address\": testData.user_data.ip_address,\n    \"client_user_agent\": testData.user_data.user_agent,\n  },\n  \"custom_data\": {\n    \"currency\": testData.currency,\n    \"value\": testData.value,\n    \"content_name\": testData.content_name,\n    \"content_category\": testData.content_category,\n    \"content_brand\": testData.content_brand,\n    \"content_ids\": testData.content_ids,\n    \"contents\": testData.contents,\n    \"num_items\": makeInteger(testData.num_items),\n    \"order_id\": testData.order_id,\n    \"search_string\": testData.search_string,\n    \"opt_out_type\": testData.opt_out_type,\n    \"np\": DEFAULT_NAMED_PARTNER\n  },\n  \"language\": testData.language\n  };\n\n  mock('getAllEventData', () => {\n    return inputEventModel;\n  });\n\n  var apiEndpoint = 'https://api.pinterest.com/v5/ad_accounts/';\n  const requestEndpoint = [apiEndpoint, testConfigurationData.advertiserId, '/events'].join('');\n\n  let requestData = {data: [expectedEventData]};\n  const requestHeaderOptions = {\n    headers: {'content-type': 'application/json',\n              'Authorization':'Bearer ' + testConfigurationData.apiAccessToken},\n    method: 'POST'};\n\n  let actualSuccessCallback, httpBody;\n  mock('sendHttpRequest', (postUrl, response, options, body) => {\n    actualSuccessCallback = response;\n    httpBody = body;\n    actualSuccessCallback(200, {}, '');\n  });\n\n\n___NOTES___\n\nPoints of Contact:\n\nYuchen Mou <ymou@pinterest.com>\nJian Li <jianli@pinterest.com>\nMirko J. Rodriguez Mallma <mrodriguezmallma@pinterest.com>\n\nCreated on 6/2/2022, 4:47:28 PM\nUpdated on 06/30/2023, 12:00:00 PM\n\n\n",
                "galleryReference": {
                    "host": "github.com",
                    "owner": "pinterest",
                    "repository": "ss-gtm-template",
                    "version": "f3f5274f7719f579efa5db2d4150e73fa01e41b9",
                    "signature": "b2d2fe6533f63648985f2b7ec377de2fe35db64c5f1cf28a99a02171f5faedd4",
                    "galleryTemplateId": "PL3ZM"
                }
            }
        ]
    }
}