Hello,
The script can be set in pages and cloud templates in a raw html element using the tagDiv Composer. For more information about how the code should be used please check this article – https://www.analyticsmania.com/post/datalayer-push/
Thank you!
Hi,
To determine the formLocation for each of your two lead forms on a page, you need to customize your dataLayer push code appropriately for each form.
You need to identify the Forms. You can use different IDs, classes, or any other attributes that distinguish them.
Add dataLayer.push for Each Form: For each form, you’ll need to add a dataLayer.push event when the form is submitted. You can include the formLocation parameter in this push event to specify where the form was located. Here’s an example:
code – https://pastebin.com/XWmKnKHN
Do the same process for your second lead form (with a different ID or class) and set the appropriate formLocation value for it.
I hope this will help you!
-
This reply was modified 2 years by
Calin.
Dear Calin,
thanks a lot for your response.
How can I use your solution for Leads element?
Moreover, I entered this script into HTML element.
<sscript>
window.dataLayer.push({
‘event’: ‘wlb-sent’
});
</sscript>
However, it is fired every time the page is loaded.
I need to execute the script when the button is pressed .
Ideally, when the checkbox is checked.