Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6834147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:04:32+00:00 2026-05-26T23:04:32+00:00

I am having some trouble implementing a JQuery star rating plugin. The plugin in

  • 0

I am having some trouble implementing a JQuery star rating plugin. The plugin in question can be found at http://orkans-tmp.22web.net/star_rating/

The trouble I’m having is passing the score off to Google analytics. I have managed to implement the plugin but for some reason the code will not fire the analytics custom event. The correct current value is alerted when the stars are clicked, which is the value I want to pass to the Google analytics event tracking.

Any help would be much appreciated, my code is as follows:

<link rel="stylesheet" type="text/css" media="screen" href="css/styles.css"/>   
<script type="text/javascript" src="js/jquery.min.js></script>
<script type="text/javascript" src="js/jquery-ui.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.ui.stars.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.ui.stars.css"/>


<script type="text/javascript">
    var url = location.href;

    $(function ratingStars(){
        $("#ratings").stars({
            captionEl: $("#stars-cap"),
            oneVoteOnly: false,
        });
    });

    $(document).ready(function(){
        $('.ui-stars-star').click(function() {
            // Retrieve instance
            var ui = $("#ratings").data("stars");
            var currValue = ui.options.value;
            //alert the currValue to make sure it is in place.
            alert(currValue);
           //send data to track
          _gaq.push(['_trackEvent', 'UATRatingTest', 'UATRatingTest2', url, currValue]);
        });
    });
</script>

<div class="RatingStars">
    <form id="ratings">
        <input type="radio"  name="rate" value="1" title="Poor" id="rate1" />
        <input type="radio"  name="rate" value="2" title="Fair" id="rate2" /> 
        <input type="radio"  name="rate" value="3" title="Average" id="rate3" /> 
        <input type="radio"  name="rate" value="4" title="Good" id="rate4" /> 
        <input type="radio"  name="rate" value="5" title="Excellent" id="rate5" />
    </form>
<span style="margin-right:5px; margin-left:10px;"> Rating: </span> <span id="stars-cap"></span> <br/>

The plugin creates a

<div class="ui-stars-star"> 

for each star which is why I put a click function on it, to try and submit the score given.

If anyone has any previous experience with the plugin that would be great.

Thanks,

Simon

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:04:32+00:00Added an answer on May 26, 2026 at 11:04 pm

    I found the answer to my problem. It appears the currValue was being parsed as a String, not an integer which is required by analytics to fire the script. I solved it by converting the value into an integer using the following code:

    var myString = currValue;
    var myConvertedInteger;
    myConvertedInteger = parseInt(myString);
    //Check string has been converted 
    alert(myConvertedInteger);
    _gaq.push(['_trackEvent', 'UATRatingTest', 'UATRatingTest2', url, myConvertedInteger]);
    

    Thanks for your input Rory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm having some trouble implementing a fixed table header with CSS and jQuery, though
I'm having trouble implementing this jQuery plugin for dynamic forms while following this tutorial
I'm implementing a class-like structure in jQuery, but I'm having some trouble when I
Been having some trouble implementing a single-column index in LaTeX. I've been employing the
I'm having trouble implementing a nested class who's constructor is initialized with some of
I'm having some trouble implementing DoubleBuffer into my program. Before you faint from the
I am having some trouble with implementing my own observer in Java on the
I'm having some trouble implementing C2DM registration. My BroadcastReceiver is never called. I'm working
I´m having some trouble implementing a dynamic tree structure using the primefaces tree implementation.
I'm having some trouble implementing pure virtual functions inherited from some abstract class, when

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.