Php 未将事件推送到GTM中的数据层(Wordpress站点)

Php 未将事件推送到GTM中的数据层(Wordpress站点),php,wordpress,google-analytics,google-tag-manager,laravel-blade,Php,Wordpress,Google Analytics,Google Tag Manager,Laravel Blade,我在Wordpress站点上设置了一个带有数据层变量的登录页。我注意到在预览模式下,我的事件有时没有记录在预览调试器中。有人能帮我看看我做错了什么吗 我在下面分享我的.php模板文件和我的GTM设置。如果有帮助的话,我正在使用PHP刀片模板(Laravel)。单击“注册”将生成一些PHP代码,这些代码进行API调用,然后从服务器检索响应。然后将其保存到变量$response中 <head> <script async src="mygoogletagmanager.com

我在Wordpress站点上设置了一个带有数据层变量的登录页。我注意到在预览模式下,我的事件有时没有记录在预览调试器中。有人能帮我看看我做错了什么吗

我在下面分享我的.php模板文件和我的GTM设置。如果有帮助的话,我正在使用PHP刀片模板(Laravel)。单击“注册”将生成一些PHP代码,这些代码进行API调用,然后从服务器检索响应。然后将其保存到变量$response中

<head>
   <script async src="mygoogletagmanager.comurl"></script>
   <script>window.dataLayer = window.dataLayer || [] </script>
</head>


**.blade.php file**
@if('POST' == $_SERVER['REQUEST_METHOD'])
    @if(isset($response))
        <script>
            window.dataLayer.push({
                'event': 'myEvent',
                'eventCallback': function() {
                     console.log('hello world!');
                     window.location="https://someotherurl.com"
                },
               'eventTimeout': 2000
            })
        </script>
     @endif
@endif

<form method="POST">
    <button>Sign up</button>
</form>

window.dataLayer=window.dataLayer | |[]
**.blade.php文件**
@if('POST'=$\u服务器['REQUEST\u方法])
@如果(isset($response))
window.dataLayer.push({
“事件”:“myEvent”,
“eventCallback”:函数(){
log('helloworld!');
window.location=”https://someotherurl.com"
},
“eventTimeout”:2000
})
@恩迪夫
@恩迪夫
注册
我在预览模式中看到的是,事件没有被记录,但console.log正在发生,当我单击按钮时,URL会发生变化

提前谢谢你的帮助