简体   繁体   English

有没有办法创建一个HTML按钮,可以在点击时拨打电话,还可以重定向到页面网址?

[英]Is there a way to create an HTML button that places a phone call on click, but also redirects to a page url?

I'm trying to track conversions for my advertisements. 我正在尝试跟踪广告的转化次数。 To accomplish this I need to place code from Google onto a specific page that users would go to after "buying" or calling in my case. 为了实现这一点,我需要将来自Google的代码放到一个特定的页面上,用户在“购买”或在我的情况下打电话后会去。

My issue is that setting this code up on the homepage would be useless for tracking conversions as it would just count people coming to my home page as a sale. 我的问题是,在主页上设置此代码对于跟踪转化无用,因为它只会计算人们作为销售进入我的主页。 Is there any way the button on the home page that places a call for the user can ALSO redirect them to a 'thank you' page where I can place the conversion tracking code? 是否有任何方式主页上的按钮为用户拨打电话也可以将它们重定向到“谢谢”页面,我可以在其中放置转换跟踪代码?

If not, is there a way to automatically place a call when the user loads a specific page? 如果没有,有没有办法在用户加载特定页面时自动发出呼叫?

Regards, 问候,

Chris 克里斯

I am assuming you are using google analytics? 我假设你正在使用谷歌分析? If so, you can track the button click event. 如果是这样,您可以跟踪按钮单击事件。 Here is the documentation 这是文档

document.getElementById('YOUR_BUTTON_ELEMENT').onclick = function(e){
  ga('send', {
    hitType: 'event',
    eventCategory: 'YOUR_CATEGORY_NAME',
    eventAction: 'YOUR_ACTION_NAME',
    eventLabel: 'YOUR_LABEL_NAME'
  });
}

You can find out how you can set up the eventCategory, eventAction, and eventLabel names by reading the documentation. 您可以通过阅读文档了解如何设置eventCategory,eventAction和eventLabel名称。

I hope that helps! 我希望有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM