通用Google Analytics跟踪已发送/感谢您页面

时间:2022-03-07 14:04:12

First of all I'm complete new on advance Analytic apart from just adding the main tracking code.

首先,除了添加主要的跟踪代码之外,我还提供了全新的Analytic。

We want to track the message sent page on our contact from our php website(not wp) on analytics.

我们希望通过我们的php网站(而不是wp)跟踪我们联系人发送的消息。

The contact form submit to itself for validation

联系表单提交给自己进行验证

How do I add a code that tracks the message sent. when php load the message "sent".

如何添加跟踪发送消息的代码。当php加载消息“发送”。

Should it be just code below next to "Sent" message and it will appear on analytic already?

它应该只是“已发送”消息旁边的代码,它是否会出现在分析上?

 <script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('send', 'event', 'Contace Form', 'Message Sent');
</script>

1 个解决方案

#1


0  

If that is the only GA code on your page, then it's not going to track anything because you have not actually created the GA tracking object

如果这是您网页上唯一的GA代码,则它不会跟踪任何内容,因为您实际上没有创建GA跟踪对象

ga('create', 'UA-xxxxx-f');
ga('send', 'event', 'some category', 'some action');

If you already have the GA tracking code on the page somewhere else, then there's no need to include it again.

如果您已在其他位置的页面上拥有GA跟踪代码,则无需再次包含该代码。

#1


0  

If that is the only GA code on your page, then it's not going to track anything because you have not actually created the GA tracking object

如果这是您网页上唯一的GA代码,则它不会跟踪任何内容,因为您实际上没有创建GA跟踪对象

ga('create', 'UA-xxxxx-f');
ga('send', 'event', 'some category', 'some action');

If you already have the GA tracking code on the page somewhere else, then there's no need to include it again.

如果您已在其他位置的页面上拥有GA跟踪代码,则无需再次包含该代码。