简体   繁体   English

在Google跟踪代码管理器数据层上映射WordPress插件数据

[英]Mapping WordPress plugin data on Google Tag Manager dataLayer

I am using the Give Donation WP plugin for a charitable website. 我正在为慈善网站使用Give Donation WP插件。 The Stripe Payment add-on has also been integrated to allow Credit Card donations on our site. Stripe Payment附加组件也已集成,以允许在我们的网站上进行信用卡捐赠。 The client has tasked me to map this data on the dataLayer array of the Google Tag Manager. 客户委托我将这些数据映射到Google跟踪代码管理器的dataLayer数组上。 After filling out the form, the plugin generates the following arguments. 填写表格后,插件会生成以下参数。

  • donor 捐赠者
  • date 日期
  • total_donation total_donation
  • donation 捐款
  • donation_status donation_status
  • donation_id donation_id
  • payment_key Payment_key
  • payment_method 付款方法

How can I populate the dataLayer with these arguments. 如何使用这些参数填充dataLayer。 Here is the dataLayer syntax. 这是dataLayer语法。

 dataLayer = [{ 'transactionId': 'payment_key', 'transactionTotal': total_donation, 'event':'transactionComplete', 'transactionProducts': [{ 'sku': 'donation_id', 'name': 'donor', 'price': total_donation, 'quantity': 1 },{ 'sku': 'donation_id', 'name': 'donor', 'price': total_donation, 'quantity': 1 }] }]; 

I tried many ways such as adding php scripts in the dataLayer withoutany luck. 我尝试了许多方法,例如在dataLayer中添加php脚本而没有任何运气。 These arguments can be found in 'wp-content/plugins/give/templates/shortcode-receipt.php' file. 这些参数可以在“ wp-content / plugins / give / templates / shortcode-receipt.php”文件中找到。 They are generated in a shortcode [give_receipt] which you can place on any WordPress. 它们以简码[give_receipt]生成,您可以将其放在任何WordPress上。 I entered the entire shortcode and I did get the results but along with the unnecessary HTML tags. 我输入了完整的简码,但确实得到了结果,但附带了不必要的HTML标记。

How can I populate these give plugin variables on GTM dataLayer. 如何在GTM dataLayer上填充这些Give插件变量。 Any help would be appreciated. 任何帮助,将不胜感激。 Thanks! 谢谢!

我认为问题是total_donation没有定义。

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

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