Viewing 15 posts - 1 through 15 (of 16 total)
  • Posted in: Dante
  • #124499
    wochurch
    Member
    Post count: 55

    We currently use visistat.com to track our web statistics. I was able to put in the global page tracking javascript snippet, and that’s working perfectly. But there is an onclick event that I can add to individual links that allows me to track more specifically.

    Here’s what I need to add:
    ONCLICK="VSCapture('page-name-here')" TARGET="new"

    So, for example I have this link:
    <h1 style="text-align: center;">GIVE THANKS | Sunday, November 23 | Bridgestone Arena | <a title="Tickets" href="http://www.wochurch.org/givethanks/tickets/">Get Tickets</a></h1>

    and I make it this:
    <h1 style="text-align: center;">GIVE THANKS | Sunday, November 23 | Bridgestone Arena | <a ONCLICK="VSCapture('page-name-here')" TARGET="new" title="Tickets" href="http://www.wochurch.org/givethanks/tickets/">Get Tickets</a></h1>

    After adding the tracking code and updating the page, it strips the onclick event from the code and leaves it like this:
    <h1 style="text-align: center;">GIVE THANKS | Sunday, November 23 | Bridgestone Arena | <a title="Tickets" href="http://www.wochurch.org/givethanks/tickets/" target="new">Get Tickets</a></h1>

    Can you tell me how I should be adding these to individual links?

    #124513
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779
    #124520
    wochurch
    Member
    Post count: 55
    This reply has been marked as private.
    #124538
    Rui Guerreiro – SUPPORT
    Keymaster
    Post count: 25779
    This reply has been marked as private.
    #124545
    wochurch
    Member
    Post count: 55
    This reply has been marked as private.
    #124679
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please insert extra class named trackMe for tracking link. Now use this code at custom JS of theme options.

    <script>
    jQuery( document ).ready(function($) {
    $( "a.trackMe" ).click(function() {
    VSCapture($(this).text()); return true;
    });
    
    });
    </script>

    Thanks
    Mohammad

    #124740
    wochurch
    Member
    Post count: 55

    You guys are brilliant. Okay, so where do I pass the name variable?

    `ONCLICK=”VSCapture(‘page-name-here’)” TARGET=”new”

    page-name-here is user defined to help organize the links on the backend.

    #124744
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I already passed page name through this code $(this).text() .
    Thanks
    Mohammad

    #124746
    wochurch
    Member
    Post count: 55

    Ah, okay. I apologize for not explaining my question very well and I appreciate your patience.

    page-name-here is the name of the individual href I’m tracking. So I could have 50 of these on one page, and I’ll need to be able to sort them out on the backend later by the name I give them.

    #124747
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please remove last one code and use this one new code:-

    <script>
    jQuery( document ).ready(function($) {
    $( "a.trackMe" ).click(function() {
    VSCapture($(this).attr('href')); return true;
    });
    
    });
    </script>

    Thanks
    Mohammad

    #124748
    wochurch
    Member
    Post count: 55

    href is my variable?

    #124749
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Yes, i did as you want.
    Thanks
    Mohammad

    #124763
    wochurch
    Member
    Post count: 55

    Okay, so I’ll put this line in the custom JS field:

    <script>
    jQuery( document ).ready(function($) {
    $( "a.trackMe" ).click(function() {
    VSCapture($(this).attr('href')); return true;
    });
    
    });
    </script>

    And I’ll put trackMe in the extra class field when I’m editing the content and link.

    How do I change the variable for each link? For example, in the old cold:

    ONCLICK=”VSCapture(‘link1’)” TARGET=”new”
    ONCLICK=”VSCapture(‘link2’)” TARGET=”new”
    ONCLICK=”VSCapture(‘link3’)” TARGET=”new”

    Would render on the backend:
    link1 = 31 clicks
    link2 = 100 clicks
    link3 = 57 clicks

    #124802
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You need trackMe as extra class. I am not sure about your old code. My code will work for all links with trackMe class.
    Thanks
    Mohammad

    #124809
    wochurch
    Member
    Post count: 55

    Unfortunately, I haven’t been able to make this work.

    Here’s their guide to tracking links. This will do a better job than I have at explaining what needs to happen. I will ultimately need to be able to do both ASYNCHRONOUS EVENT TRACKING and LINK TRACKING.

    http://www.visistat.com/tracking/help.php?hs=event%20and%20link%20tracking

    On this last go, I put this in the custom JS:

    <script>
    jQuery( document ).ready(function($) {
    $( "a.trackMe" ).click(function() {
    VSCapture($(this).attr('href')); return true;
    });
    
    });
    </script>

    and in the extra class name at the bottom of the text box I put trackMe (I also tried putting it inline:

Viewing 15 posts - 1 through 15 (of 16 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register