Data Layer Push for Leads

Posted in: Newspaper
Post count: 72

Dear TagDiv,
how can I start // dataLayer.push({‘event’:’wlb-sent’}) when the user registers/Subscribes for Leads.

Post count: 35449

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!

Post count: 72

Thanks a lot.

If I have two Leads forms on page, how can I find out the ‘formLocation’?

Post count: 35449

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.
Post count: 72

.

Post count: 72

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.

Post count: 72

I use Sscript as otherwise I am not able to post the code.

Post count: 35449

Hi,
Indeed, the css code is the one that is usually work, I also set some JavaScript and html but this was not displayed, I corrected the previous answer to can check the provided example.
Thank you!

Viewing 8 posts - 1 through 8 (of 8 total)
The forum ‘Newspaper’ is closed to new topics and replies.