2017-03-15 195 views
0

嘿,因为Ga的跟踪代码是在PHP输出我似乎无法让它的功能。 PHP之外的跟踪代码工作正常,但我想随着我想使用3种类型的“'这可能会导致一个问题?谷歌Analytics(分析)PHP中的事件跟踪不起作用

$prodqoutput = 
'<div class="container" style="margin-bottom: 50px;"> 
    <div class="col-sm-6 col-md-4"> 
    </div> 
    <div class="col-sm-6 col-md-4"> 
     <img src="' . $llogo . '" style="width: 100%;"><br /> 
     <center><span>' . $lexcerpt . '</span></center> 
     <a href="' . $laffil . '" target="_blank" onClick="ga(‘send’, ‘event’, ‘Card Image’, ‘'.$brand.'’, ‘'.$etitle.'’);"> 
      <button style="height: 50px;" type="button" class="btn btn-primary btn-lg btn-block"> 
       View More Products! <span class="glyphicon glyphicon-refresh"></span> 
      </button> 
     </a> 
    </div> 
    <div class="col-sm-6 col-md-4"> 
    </div> 
</div>'; 

如果有人可以帮助这将是惊人的。

。在此先感谢

回答

1

尝试改变这部分代码:

onClick="ga(\'send\', \'event\', \'Card Image\', \''.$brand.'\', \''.$etitle.'\');"> 

只能使用"'并在需要时(如在你的前充足)你可以预览\

+0

同意,你需要花''或',如果你看看你看到的代码''(曲线apostrofe),这个字符将无法正常工作。 –

相关问题