Support » Plugin: Yoast SEO » Support for Google Analytics enhanced link attribution


    It appears WordPress SEO does not support Google Analytics’ enhanced link attribution functionality.

    Fundamentally, it allows webmasters to:

    a) See separate click information isolated for multiple links on a page that all have the same destination

    b) see when one page element has multiple destinations

    c) track buttons, menus, and actions driven by javascript

    All are VERY helpful to understand usability – especially when menus duplicate page links.

    The requirements are simple:

    1) Add a checkbox in WordPress SEO admin to flag if user wants Enhanced Link Attribution turned on.

    2) If the option is selected, the following code:

    var pluginUrl =
    _gaq.push([‘_require’, ‘inpage_linkid’, pluginUrl]);

    is added to the current Google Analytics code between the following lines:

    var _gaq = _gaq || [];


    _gaq.push([‘_setAccount’, ‘UA-XXXXXX-Y’]);

    That’s all.

    Would think this is a no-brainer and about 5 minutes of work if you stop to grab a cup of coffee and take a pee in the process…


    Here is the link to Google’s description of the functionality:

Viewing 7 replies - 1 through 7 (of 7 total)
  • In the Advanced Settings of the plugin there is a field for Custom Code. Have you tried to add the new code snippet into that field? I haven’t had a chance to test it for myself but I believe that should accomplish what is needed.

    Using the Advanced Setting -> Custom Code field in the Google Analytics plugin puts the new Enhanced Link code after the ‘setAccount’ statement…not before it as Google suggests. I’m not sure if this will cause any issues or not, can anyone confirm if it works on not this way?

    When I view source, it appears to have put it in the correct place. Doesn’t seem to be working…. but in the right place.

    Has anyone gotten it to work correctly yet? If so, how? Thanks!

    I tried the same: adding the code like described here:
    var _gaq = _gaq || [];
    var pluginUrl = ((‘https:’ == document.location.protocol) ?
    ‘https://ssl.’ : ‘http://www.’) +
    _gaq.push([‘_require’, ‘inpage_linkid’, pluginUrl]);
    _gaq.push([‘_setAccount’, ‘UA-XXXXXX-Y’]);

    via putting the var pluginUrl = ((‘https:’ == document.location.protocol) ?
    ‘https://ssl.’ : ‘http://www.’) +
    _gaq.push([‘_require’, ‘inpage_linkid’, pluginUrl]); in the custom field in yoast analytics. the result was that the realtime function was not working any more in analytics. after deleting the code snippet in custom field in yoast, it was working again fine … don’t know how to add the enhanced link feature in another way. maybe via putting it inside the files of the plugin itself?

    would be great to have the possiblity to insert this code

    no, analytics is working, but not the enhanced link attribution. don’t know why, but by adding the “enhanced link attribution” code to yoast analytics custom field, it s not working. anybody ideas?
    thanks wombii

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Support for Google Analytics enhanced link attribution’ is closed to new replies.