• Resolved Der-Bank-Blog

    (@der-bank-blog)


    Hi

    is there a way to track clicks on the WordPress Popular Posts Widget, e.g. with Google Anayltics?

    Cheers from Germany

    Hansj?rg

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter Der-Bank-Blog

    (@der-bank-blog)

    Hi

    Is there a Chance for an answer? I would really apreciate it

    Cheers

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi Hansj?rg!

    Well, as you can see I’m trying to catch up with everyone here and just got to this message ??

    I’m pretty sure it is possible to tell GA to keep track of specific links (eg. the ones from the popular posts list). I’m not sure how it’s done though, it’s been a while since I played around with GA. I will investigate about this as soon as I can and get back to you later.

    Thread Starter Der-Bank-Blog

    (@der-bank-blog)

    Hi Hector

    great. Thanks. As far as I understand GA, one has to add some strings to the link, like
    “?utm_medium=wpp&utm_source=wpp”

    So my question is, how this can be done

    Cheers

    Hansj?rg

    Plugin Author Hector Cabrera

    (@hcabrera)

    Alright, if that’s the case then here’s an example using the code you posted here:

    [wpp post_type="post" range="weekly" stats_views=0 thumbnail_width=351 thumbnail_height=185 excerpt_format=1 stats_author=1 excerpt_length=400 order_by="views" post_html='<li><h3><a href="{url}?utm_medium=wpp&utm_source=wpp">{text_title}</a></h3><div>von: {author}</div> <a href="{url}?utm_medium=wpp&utm_source=wpp">{thumb_img}</a><div>{summary}</div></li>']

    I switched the content tags {title} and {thumb} with <a href="{url}?utm_medium=wpp&utm_source=wpp">{text_title}</a> and <a href="{url}?utm_medium=wpp&utm_source=wpp">{thumb_img}</a>, respectively.

    Thread Starter Der-Bank-Blog

    (@der-bank-blog)

    Hi Hector

    thanks. Is it possible to integrate this in the sidebar widget too?

    Cheers

    Hansj?rg

    Plugin Author Hector Cabrera

    (@hcabrera)

    Yep!

    1. Go to Widgets > WordPress Popular Posts.
    2. Enable the “Use custom HTML markup” checkbox under “HTML markup settings”.
    3. Set the “Post HTML markup” field to <li><h3><a href="{url}?utm_medium=wpp&utm_source=wpp">{text_title}</a></h3><div>von: {author}</div> <a href="{url}?utm_medium=wpp&utm_source=wpp">{thumb_img}</a><div>{summary}</div></li> (adjust where needed.)
    4. Profit!
    Thread Starter Der-Bank-Blog

    (@der-bank-blog)

    Awesome.

    Thanks a lot

    How can i add tracking code based on the condition like if url has ‘?’ then append ‘&elq=true’ otherwise ‘?elq=true’

    Thanks

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi @bpatel!

    Since your case requires changing the URL dynamically, you’ll have to either use Javascript or WPP’s filter hooks to modify the output. I’ll take the easy route and show you how I would do it using our good ol’ jQuery magic:

    jQuery('.wpp-list li a').attr('href', function() {
        return ( this.href.indexOf("?") >= 0 ) ? this.href + "&elq=true" : this.href + "?elq=true";
    });
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Click Tracking’ is closed to new replies.