Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/redis/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google转换未在PHP页面中注册_Php_Analytics_Tracking_Google Ads Api_Goal Tracking - Fatal编程技术网

Google转换未在PHP页面中注册

Google转换未在PHP页面中注册,php,analytics,tracking,google-ads-api,goal-tracking,Php,Analytics,Tracking,Google Ads Api,Goal Tracking,虽然对编码来说比较陌生,但我以前已经成功地实现了许多跟踪代码,但是我在获取一个转换代码以在我的站点上注册时遇到了严重的问题 虽然我在代码中把它放到了PHP的相关部分,甚至做了测试转换,并在源代码中看到了它,但Google没有注册一个转换,目标仍然显示为“未验证” 我读过各种博客,以及谷歌对用PHP实现代码的看法——其中大多数似乎彼此不一致。如果有人有任何想法,我将非常感激,因为这是跟踪我的AdWords表现的一个关键指标 下面是谷歌给我的代码,让我实现原封不动: <!-- Google C

虽然对编码来说比较陌生,但我以前已经成功地实现了许多跟踪代码,但是我在获取一个转换代码以在我的站点上注册时遇到了严重的问题

虽然我在代码中把它放到了PHP的相关部分,甚至做了测试转换,并在源代码中看到了它,但Google没有注册一个转换,目标仍然显示为“未验证”

我读过各种博客,以及谷歌对用PHP实现代码的看法——其中大多数似乎彼此不一致。如果有人有任何想法,我将非常感激,因为这是跟踪我的AdWords表现的一个关键指标

下面是谷歌给我的代码,让我实现原封不动:

<!-- Google Code for Almost there Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 974608389;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "d5KfCMunhgUQhbDd0AM";
var google_conversion_value = 0;
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/974608389/?value=0&amp;label=d5KfCMunhgUQhbDd0AM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>

/*  */
现在,按照Google希望您为PHP编辑代码的方式,在下面的部分中详细介绍:


/* ;
}
/* ]]> */
我已经浪费了大约3天的时间在这个问题上,现在断断续续,并且花了足够长的时间试图点击广告并创建假帐户来测试它,以使其触发

作为另一项保障措施,我将在下面完整发布相关的PHP部分。

这是确认订阅付款的一部分,它可能有助于确保您永远不会拥有太多信息,诊断问题

<?php
/* Template Name: Subscription Confirmation */

  if (isset($_POST['activate_subscription']) && isset($_POST['token'])) {
    $activation = completeSubscription($_POST['token']);
    //completeSubscription Handles everything here. If this even runs, it's all gone wrong.
    $activate_failed = true;
  } else if (isset($_GET['token']) && isset($_GET['PayerID'])) {
    $transaction = getTransactionDetails($_GET['token']);
    if ($transaction['ACK'] == "Success") $sub = updateSubscriptionDetails($transaction);
  } else {
    header("Location: /join/membership/");
    exit();
  }



  get_header();
?>

<div class="row subhero">
  <div class="twelve columns">

    <?php if (!isset($activate_failed) && $transaction['ACK'] == "Success") { ?>

      <h1>Almost there!</h1>
      <p class="subheader">Thank you for configuring your subscription with PayPal.</p>
//***************** ANALYTICS CODE
<!-- Google Code for Subscription Conf Conversion Page -->
<script type="text/javascript">
/* <![CDATA[ */
var google_conversion_id = 974608389;
var google_conversion_language = "en";
var google_conversion_format = "3";
var google_conversion_color = "ffffff";
var google_conversion_label = "d5KfCMunhgUQhbDd0AM";
if (<%= totalValue %) {
    var google_conversion_value = <%= totalValue %>;
}
/* ]]> */
</script>
<script type="text/javascript" src="//www.googleadservices.com/pagead/conversion.js">
</script>
<noscript>
<div style="display:inline;">
<img height="1" width="1" style="border-style:none;" alt="" src="//www.googleadservices.com/pagead/conversion/974608389/?value=0&amp;label=d5KfCMunhgUQhbDd0AM&amp;guid=ON&amp;script=0"/>
</div>
</noscript>
//*********************END OF ANALYTICS CODE
  </div>
  </div>      
</div> <!-- end container -->
<div class="buyticketarea">
    <div class="row">
        <div class="eight columns offset-by-two">       


      <p class="subheader">Please confirm the following details. Once you proceed you will be billed immediately for your first month of <strong><?php echo $transaction['L_NAME0']; ?></strong> at <strong>&pound;<?php echo $transaction['L_AMT0']; ?>.</strong></p>
      <p class="subheader">Additionally, you will be billed <strong>&pound;<?php echo $transaction['L_AMT0']; ?></strong> on the <strong><?php echo date('j'); ?><sup><?php echo date('S'); ?></sup></strong> of each month, starting on <strong><?php echo getNextBillingDayHuman(); ?>.</strong></p>
      <p class="subheader">If you're happy to proceed...</p>
      <form method="post">
        <input type="hidden" name="sub_id" value="<?php echo $transaction['INVNUM']; ?>" />
        <input type="hidden" name="token" value="<?php echo $_GET['token']; ?>" />
        <input type="hidden" name="PayerID" value="<?php echo $_GET['PayerID']; ?>" />
        <input class="button" type="submit" name="activate_subscription" value="Activate Subscription" />
      </form>

    </div>
    </div>  
</div>

我觉得这句话不对:

if (<%= totalValue %) {
    var google_conversion_value = <%= totalValue %>;
}
if (<%= totalValue %) {
    var google_conversion_value = <%= totalValue %>;
}
if (<?php echo $totalValue ?>) {
    var google_conversion_value = <?php echo totalValue ?>;
}
var google_conversion_value = 10;