• vzaguski

    (@vzaguski)


    Couldn’t enable cross domain tracking – “_link” event is not set for specified domains and they just tracked as outbound articles.

    After looking through code I’ve found the line that could couse problem.

    Here’s the code snippet:
    —–

    } else if ( $target["domain"] != $origin["domain"] ){
    					$crossdomains = explode(',',str_replace(' ','',$options['othercrossdomains']));
    					if ( $options['trackcrossdomain'] && in_array($target["host"],$crossdomains) ) {
    						$trackBit = '_gaq.push([\'_link\', \'' . $matches[2] . '//' . $matches[3] . '\']); return false;"';
    					} else if ( $options['trackoutbound'] && in_array($options['domainorurl'], array('domain','url')) ) {
    						$url = $options['domainorurl'] == 'domain' ? $target["host"] : $matches[3];
    						$trackBit = GA_Filter::ga_get_tracking_link($category, $url,'');
    					}
    					$trackBit = GA_Filter::ga_get_tracking_link($category, $url,'');
    				}

    ——
    [Code moderated: please ensure that your code is enclosed in backticks (`) or use the code button.]

    Actually, the last line in the code is the problem. If I delete it, it seems to work as expected.

    https://www.ads-software.com/extend/plugins/google-analytics-for-wordpress/

Viewing 15 replies - 1 through 15 (of 18 total)
  • I’m having the same issue, even when disabling outgoing link tracking and commenting out the offending line of code from above. Does anyone have a fix for this in version 4.2.4? All links appear as outgoing whether they are listed in the specified domain list or not. Thanks!

    Has anyone figured this out? Yoast doesn’t appear to frequent this board often. Thanks!

    We have a similar issue. Basically our conversion paths are not being tracked correctly between our site – socialbizzle.com and our payment processor – Fastspring.

    All conversions appear as a ‘direct source’ even though they are occurring through adwords and other marketing channels.

    I thought the problem would be solved now I have removed the ‘track clicks and downloads option’.

    Are you saying that you have done that and it still doesn’t work correctly?

    Had the exact same thing, as a quick fix, commenting out the line worked for me in the latest version (comment out the right line, there are multiple lines having the same code), but I’ll try to find out as to why this behaviour occurs.

    wpaholic

    (@wordpressaholic)

    +1

    Paul

    (@paultgoodchild)

    +1
    This is a real problem… thanks for finding the quick fix.

    If you’re out there Yoast, can ya take a look at this little bug – it’s quite important for all cross-domain tracking.

    Thanks! ??

    Seems to be working fine for me. I thought it was broken but realized I was logged in as admin. Doublecheck that’s not the case for you!

    erm actually I’ve got that wrong. What I am seeing is this:

    <a target="_blank" onclick="javascript:_gaq.push(['_trackEvent','outbound-article','']);" href="https://my-out-bound-domain.org/">Outbound link</a>

    I tried checking and unchecking the option “Track outbound clicks & downloads:” and the onclick event stays either way. Strange?

    It looks like the checkbox for “Enable Cross Domain Tracking:” is actually adding the _trackEvent instead of _link as expected. Checking this box also generates a notice:

    Notice: Undefined variable: url in {MY PATH}/httpdocs/wp-content/plugins/google-analytics-for-wordpress/googleanalytics.php on line 1161

    This notice appears whether or not the field “Cross-Domain Tracking, Other Domains:” is filled in.

    After a bit of playing around I did find that the original poster’s fix does indeed work. The line at 1161 $trackBit = GA_Filter::ga_get_tracking_link($category, $url,''); overwrites the $trackBit variable that was set in the blocks just above it, so commenting out this line seems to resolve the issue for me.

    Found another bug .. on line 1156, there is an extra double quote ta the end of this line, after the semi colon, before the closing single quote. $trackBit = '_gaq.push([\'_link\', \'' . $matches[2] . '//' . $matches[3] . '\']); return false;"';

    The double quote is closed again below when the $trackBit variable gets added into the $matches array, so this creates an extra quote that makes the link code a little screwy.

    Man, I’ve been looking for a plug-in that could handle cross domain tracking for my websites for a LONG TIME. This plug-in is awesome.

    But just like vzaguski and worldwisewebs have indicated, line 1161 needs to be commented out and line 1156 needs to be updated to remove that last double quote.

    Works like a charm now!

    I have been looking for a way to solve this as well, but I gave up after a few hours. I really hope this does the trick, I’ll give it try tomorrow. Fingers crossed.

    Hope this gets solved in future updates though. Good work vzaguski and wisewebs.

    It still doesn’t seem to work.

    Even removing the last line vzaguski mentioned, it is still inserting ‘_trackEvent’ instead of ‘_link’?

    Anyone got a fix for this?

    Looks like these bugs made it to 3.4.5 – now it’s line 1218 that needs to be commented out and the extra quote is on line 1213

    Hi worldwisewebs,

    Yoast has now upgraded to version 4.2.7 but still has this issue. Would greatly appreciate if you could highlight the code again?

    Thanks,
    Mart

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Plugin: Google Analytics for WordPress] cross domain tracking’ is closed to new replies.