• Hi,

    I’ve implemented the CF7 tag and trigger with the help of this Tag Manager plugin. It works but it fires twice instead of one time. In Analytics I’m seing that one is labeled with the contact form ID. The other is not labeled. Am I doing something wrong? Do you have any advice in this matter? Thanks.

    Tim.

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    I checked your site and I can see this issue, furthermore if I fill in your form again without reloading the page, I can see 4 events, filling in the form again fires 6 events.

    I set a breakpoint in my browser in the code that generates this event and it was only executed once.

    This is very strange but I can not find the reason behind that. Have you tried to disable WP Rocket? I am also using this plugin and I haven’t had an issues with that but maybe it could be related somehow to the caching mechanism.

    Thread Starter timmiieehh

    (@timmiieehh)

    hi, thanks for your reply. I found that it has something to do with the pieces of code I implemented in Google Tag Managar. I’ve added 2 tags. Tag number 1 consists the following code:

    <script>
    document.addEventListener( ‘wpcf7mailsent’, function( event ) {
    dataLayer.push({
    ‘event’ : ‘gtm4wp.contactForm7Submitted’,
    ‘CF7formID’ : event.detail.contactFormId
    });
    }, false );
    </script>

    and a trigger that activates when gtm4wp.contactForm7Submitted is being fired as an event.

    The second tag consists Universal Analytics tag type and the same trigger as with number 1. I experimented with both of them but it seems they need each other to fire an event that consists the ID type. In Analytics whenever a form has been sent there are 2 events, one with an ID and one without. If I disable one of the tags, I only see the event without an ID tag. ID meaning the contact form ID.

    Plugin Author Thomas Geiger

    (@duracelltomi)

    Hi,

    This custom HTML tag is not needed as gtm4wp.contactForm7Submitted is fired within my plugin, you do not need to fire this inside a GTM tag.

    You code includes the variable CF7formID but my plugin adds the same info into the gtm4wp.cf7formid. Depending on which data layer variable name you are using in your GTM variable, you might need to just adjust the name to be able to eliminate the use if this custom HTML tag

    Thread Starter timmiieehh

    (@timmiieehh)

    Hi,

    you’re right that I’m using a different variable because I stopped using your plugin. It doesn’t do work, atleast on our website. Without using your plugin everything works fine. So thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘gtm4wp.contactForm7Submitted fires twice per submission’ is closed to new replies.