Skip to main content
All CollectionsIntegrations
Use Google Tag Manager to send Page View events to 360dialog
Use Google Tag Manager to send Page View events to 360dialog
Updated over 3 months ago

You can send Google Tag Manager events to 360dialog, as long as they are based on Page View.

Configure Custom HTML Tag

Navigate to Google Tag Manager. Under the section Tags, click on New and you should see the page as below.

For Tag Configuration, choose Custom HTML.

Paste the following JS code and make sure to replace clientId and apiKey with the values provided by your Client Manager.

<script>
var clientId = 'xxxxxx';
var apiKey = 'xxxxxx-xxxx-xxxx-xxxx-xxxxxxx';
(function() {
var utmParams = getUTMParams();
if (Object.keys(utmParams).length > 0) {
sendTo360Dialog(utmParams);
}
})();
function getUTMParams() {
var urlSearchParams = new URLSearchParams(window.location.search);
var utmParams = {};
urlSearchParams.forEach(function(value, key) {
if (key.indexOf('utm_') === 0) {
utmParams[key] = value;
}
});
return utmParams;
}
function sendTo360Dialog(utmParams) {
var apiUrl = "https://api.signals.360dialog.io/v1/clients/" + clientId + "/pixel/gtm/page-viewed?api_key=" + apiKey;
var data = {
utm_params: utmParams
};
fetch(apiUrl, {
method: 'POST',
mode: 'no-cors',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.catch(function(error) {
console.error('360dialog - An error occurred when sending request:', error);
});
}
</script>

For Triggering, choose All Pages.

Click Save.

Preview the newly created Tag, so you can open the console and see if there are any related errors.

If not, you can Submit the tag so it is set as live.

Test configuration

Access a page that has GTM installed with the following parameter:

?utm_source=whatsapp?utm_campaign={{generated_tracking_id}}&utm_medium=SMS 

Confirm with 360dialog that event has been sucessfully received.


โ€‹

Did this answer your question?