¿Es posible usar Google Tag Manager (GTM) para trackear actividad del sitio web en SFMC utilizando Web Collect / _etmc / Einstein?

Si, y de hecho es bastante sencillo.

ANTES DE EMPEZAR.

Recuerda que, a diferencia de una herramienta de Analytics (como google analytics, por ejemplo) donde el contenido se registra de forma implícita con la URL, Web Collect registra las visitas al contenido de forma Explícita. Por lo que antes de poder siquiera tener acceso a los códigos para trackear necesitaras generar tu catálogo de contenido.

Aquí les dejo un ejemplo de un json que pueden importar en su contenedor de GTM para tener las variables y etiquetas básicas que normalmente utilizo para cargar el tracking de Web Collect en un sitio de contenido utilizando Google Tag Manager.

{
    "exportFormatVersion": 2,
    "exportTime": "2022-05-15 15:36:39",
    "containerVersion": {
        "path": "accounts/6006630610/containers/64044921/versions/0",
        "accountId": "6006630610",
        "containerId": "64044921",
        "containerVersionId": "0",
        "container": {
            "path": "accounts/6006630610/containers/64044921",
            "accountId": "6006630610",
            "containerId": "64044921",
            "name": "www.salesforcecancun.com",
            "publicId": "",
            "usageContext": [
                "WEB"
            ],
            "fingerprint": "1651528847831",
            "tagManagerUrl": "",
            "features": {
                "supportUserPermissions": true,
                "supportEnvironments": true,
                "supportWorkspaces": true,
                "supportActivities": false,
                "supportBuiltInVariables": true,
                "supportClients": false,
                "supportFolders": true,
                "supportTags": true,
                "supportTemplates": true,
                "supportTriggers": true,
                "supportVariables": true,
                "supportVersions": true,
                "supportZones": true
            }
        },
        "tag": [
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "tagId": "4",
                "name": "SFMC - Initialize Web Collect",
                "type": "html",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "html",
                        "value": "<!-- Einstein Collect Code -->\n<script>\n(function(e,t,c,n,o,s,a){e[o]=e[o]||[],s=t.createElement(c),a=t.getElementsByTagName(c)[0],s.async=1,s.src=n,a.parentNode.insertBefore(s,a)})(window,document,'script','//{{SFMC - MID}}.collect.igodigital.com/collect.js','_etmc');\n// always run this line once, followed by what you actually want to track; can be run programmatically in single-page-applications\n  _etmc.push(['setOrgId', '{{SFMC - MID}}']);\n//always run setUserInfo BEFORE anything else\n  var User_ID = {{SFMC - UserID}};\n  if ( User_ID != undefined ) {\n    _etmc.push(['setUserInfo', \n      {\n        'email': '{{SFMC - UserID}}'\n      }\n    ]);\n  };\n  _etmc.push(['trackPageView']);\n</script>\n<!-- End Einstein Collect Code -->"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "supportDocumentWrite",
                        "value": "false"
                    }
                ],
                "fingerprint": "1651699579296",
                "firingTriggerId": [
                    "2147479553"
                ],
                "parentFolderId": "10",
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "tagId": "6",
                "name": "SFMC - Web Collect Item View",
                "type": "html",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "html",
                        "value": "<script type=\"text/javascript\">\n  _etmc.push(['setOrgId', '{{SFMC - MID}}']); \n  _etmc.push(['trackPageView', { 'item' : '{{SFMC - LookupTable ItemID}}'}]);\n</script>\n"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "supportDocumentWrite",
                        "value": "false"
                    }
                ],
                "fingerprint": "1651698116104",
                "firingTriggerId": [
                    "5"
                ],
                "parentFolderId": "10",
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "tagId": "18",
                "name": "SFMC - Web Collect Click",
                "type": "html",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "html",
                        "value": "<script type=\"text/javascript\">\n  _etmc.push(['setOrgId', '{{SFMC - MID}}']); \n  _etmc.push(['trackPageView', { 'item' : '{{SFMC - Lookup Table ClickID}}'}]);\n</script>\n"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "supportDocumentWrite",
                        "value": "false"
                    }
                ],
                "fingerprint": "1651698199337",
                "firingTriggerId": [
                    "16"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "tagId": "19",
                "name": "SFMC - Web Collect Form Submission",
                "type": "html",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "html",
                        "value": "<script type=\"text/javascript\">\n  _etmc.push(['setOrgId', '{{SFMC - MID}}']); \n  _etmc.push(['trackPageView', { 'item' : '{{SFMC - Lookup Table FormID}}'}]);\n</script>\n"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "supportDocumentWrite",
                        "value": "false"
                    }
                ],
                "fingerprint": "1651698239348",
                "firingTriggerId": [
                    "17"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "tagId": "20",
                "name": "SFMC - Web Collect Video Play",
                "type": "html",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "html",
                        "value": "<script type=\"text/javascript\">\n  _etmc.push(['setOrgId', '{{SFMC - MID}}']); \n  _etmc.push(['trackPageView', { 'item' : '{{SFMC - Lookup Table Video}}'}]);\n</script>\n"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "supportDocumentWrite",
                        "value": "false"
                    }
                ],
                "fingerprint": "1651698270838",
                "firingTriggerId": [
                    "15"
                ],
                "tagFiringOption": "ONCE_PER_EVENT",
                "monitoringMetadata": {
                    "type": "MAP"
                },
                "consentSettings": {
                    "consentStatus": "NOT_SET"
                }
            }
        ],
        "trigger": [
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "triggerId": "5",
                "name": "SFMC - Window Loaded Trigger",
                "type": "WINDOW_LOADED",
                "fingerprint": "1651697347369",
                "parentFolderId": "10"
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "triggerId": "15",
                "name": "SFMC - Youtube Video Trigger",
                "type": "YOU_TUBE_VIDEO",
                "fingerprint": "1651697709568",
                "parentFolderId": "10",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "captureComplete",
                        "value": "false"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "captureStart",
                        "value": "true"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "fixMissingApi",
                        "value": "true"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "triggerStartOption",
                        "value": "DOM_READY"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "capturePause",
                        "value": "false"
                    },
                    {
                        "type": "BOOLEAN",
                        "key": "captureProgress",
                        "value": "false"
                    }
                ]
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "triggerId": "16",
                "name": "SFMC - Click Trigger",
                "type": "LINK_CLICK",
                "waitForTags": {
                    "type": "BOOLEAN",
                    "value": "false"
                },
                "checkValidation": {
                    "type": "BOOLEAN",
                    "value": "false"
                },
                "waitForTagsTimeout": {
                    "type": "TEMPLATE",
                    "value": "2000"
                },
                "uniqueTriggerId": {
                    "type": "TEMPLATE"
                },
                "fingerprint": "1651697371284",
                "parentFolderId": "10"
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "triggerId": "17",
                "name": "SFMC - Form Trigger",
                "type": "FORM_SUBMISSION",
                "waitForTags": {
                    "type": "TEMPLATE"
                },
                "checkValidation": {
                    "type": "TEMPLATE"
                },
                "waitForTagsTimeout": {
                    "type": "TEMPLATE",
                    "value": "2000"
                },
                "uniqueTriggerId": {
                    "type": "TEMPLATE"
                },
                "fingerprint": "1651697919850",
                "parentFolderId": "10"
            }
        ],
        "variable": [
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "variableId": "3",
                "name": "SFMC - MID",
                "type": "c",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "value",
                        "value": "514020894"
                    }
                ],
                "fingerprint": "1651688289937",
                "parentFolderId": "10",
                "formatValue": {}
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "variableId": "9",
                "name": "SFMC - UserID",
                "type": "u",
                "parameter": [
                    {
                        "type": "TEMPLATE",
                        "key": "component",
                        "value": "QUERY"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "queryKey",
                        "value": "artemis_id"
                    }
                ],
                "fingerprint": "1651695951945",
                "parentFolderId": "10",
                "formatValue": {}
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "variableId": "11",
                "name": "SFMC - LookupTable ItemID",
                "type": "smm",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "input",
                        "value": "{{Page Path}}"
                    },
                    {
                        "type": "LIST",
                        "key": "map",
                        "list": [
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "/"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "home"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "/page-1/"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "page_2"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "/page-2/"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "page_3"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "fingerprint": "1651689361454",
                "parentFolderId": "10",
                "formatValue": {}
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "variableId": "12",
                "name": "SFMC - Lookup Table FormID",
                "type": "smm",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "input",
                        "value": "{{Form ID}}"
                    },
                    {
                        "type": "LIST",
                        "key": "map",
                        "list": [
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "form-1"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "form_1"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "form-2"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "form_2"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "form-3"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "form_3"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "fingerprint": "1651689368110",
                "parentFolderId": "10",
                "formatValue": {}
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "variableId": "13",
                "name": "SFMC - Lookup Table ClickID",
                "type": "smm",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "input",
                        "value": "{{Click ID}}"
                    },
                    {
                        "type": "LIST",
                        "key": "map",
                        "list": [
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "fb"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "FB"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "pdf-1"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "pdf_1"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "pdf-2"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "pdf_2"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "fingerprint": "1651689374346",
                "parentFolderId": "10",
                "formatValue": {}
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "variableId": "14",
                "name": "SFMC - Lookup Table Video",
                "type": "smm",
                "parameter": [
                    {
                        "type": "BOOLEAN",
                        "key": "setDefaultValue",
                        "value": "false"
                    },
                    {
                        "type": "TEMPLATE",
                        "key": "input",
                        "value": "{{Video URL}}"
                    },
                    {
                        "type": "LIST",
                        "key": "map",
                        "list": [
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "youtube.com/1"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "video-1"
                                    }
                                ]
                            },
                            {
                                "type": "MAP",
                                "map": [
                                    {
                                        "type": "TEMPLATE",
                                        "key": "key",
                                        "value": "youtube.com/2"
                                    },
                                    {
                                        "type": "TEMPLATE",
                                        "key": "value",
                                        "value": "video-2"
                                    }
                                ]
                            }
                        ]
                    }
                ],
                "fingerprint": "1651696773263",
                "parentFolderId": "10",
                "formatValue": {}
            }
        ],
        "folder": [
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "folderId": "10",
                "name": "SFMC",
                "fingerprint": "1651688284692"
            }
        ],
        "builtInVariable": [
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "type": "PAGE_PATH",
                "name": "Page Path"
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "type": "CLICK_ID",
                "name": "Click ID"
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "type": "FORM_ID",
                "name": "Form ID"
            },
            {
                "accountId": "6006630610",
                "containerId": "64044921",
                "type": "VIDEO_URL",
                "name": "Video URL"
            }
        ],
        "fingerprint": "1652628999379",
        "tagManagerUrl": ""
    }
}

Puedes copiar ese texto e incluirlo en tu editor de texto favorito (Yo uso siempre Visual Studio Code) y guardarlo como .json.

Si lo prefieres, te dejo una versión descargable del contenedor de GTM con todas las variables y etiquetas básicas para usarlo con SFMC

En futuras sesiones de la comunidad vamos a estar platicando de este contenedor y en general de como utilizarlo para poder implementarlo en el contenido de nuestro sitio web y luego hacer Einstein recommendations en email y web también.

Si te gusta esta idea: déjanos tu like o envíanos un mensajito con tus dudas 😃

Related Posts

One thought on “¿Es posible usar Google Tag Manager (GTM) para trackear actividad del sitio web en SFMC utilizando Web Collect / _etmc / Einstein?

Leave a Reply

Your email address will not be published. Required fields are marked *