I know it's a long shot considering this was so long ago, but did you ever figure out how to use this script with google tag manager? We have the same setup and while the feedback buttons look lovely, the data doesn't actually seem to be going anywhere.Keith_Marion wrote:Dragging up an old topic because I can't seem to get it to work...
We're recording GA page hits, but of the life of me I can't get it to record events. What am I doing wrong?
Here is my masterpage:
My feedback script:Code: Select all
<?xml version="1.0" encoding="utf-8"?> <html xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" MadCap:lastBlockDepth="7" MadCap:lastHeight="604" MadCap:lastWidth="1215"> <head> <script src="../Scripts/run_prettify.js"> </script> <meta charset="utf-8" /> <meta name="description" content="" /> <meta name="author" content="" /><title></title> <link href="../Stylesheets/MainStyles.css" rel="stylesheet" type="text/css" /> <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" /> <!-- Google Tag Manager (noscript) --> <noscript> <iframe async="" src="https://www.googletagmanager.com/ns.html?id=GTM-54TR2VJ" height="0" width="0" style="display:none;visibility:hidden"></iframe> </noscript> <!-- End Google Tag Manager (noscript) --> <!-- Start Google Script --> <script type="text/jscript" src="../Scripts/Google_TagManager.js"> </script> <!-- End Google Script --> <!-- Start Feedback Script --> <script type="text/javascript" async="" src="../Scripts/google-analytics-events.js"></script> <!-- End Feedback Script --> </head>
And my Google Tag manager script:Code: Select all
<!-- Feedback Script --> $(document).ready(function(){ /* -------------- Feedback -------------- */ /* Yes click */ $('.feedback-yes').click(function() { /* fade out question, fade in thankyou message */ $('.feedback-question').fadeOut(function() { $('.feedback-reason.yes-thanks').fadeIn(); }); /* ga('send', 'event', 'Feedback - Yes', 'N/A', location.href); */ gtag('event', 'N/A', { 'event_category': 'Feedback - Yes', 'event_label': location.href }); }); /* No click */ $('.feedback-no').click(function() { /* fade out question, fade in thankyou message */ $('.feedback-question').fadeOut(function() { $('.feedback-reason.no').fadeIn(); }); }); /* No - response reasons */ $('.feedback-reason .option').change(function() { /* if any options change, disable checkbox, record event, and fade in thankyou and email link */ $(this).attr('disabled', true); if ($(this).is(':checked')) { /* get the label text of the reason (option) text that's selected */ var reason = (this).attr('data-analytics-label'); /* ga('send', 'event', 'Feedback - No', reason, location.href); */ gtag('event', reason, { 'event_category': 'Feedback - No', 'event_label': location.href }); } $('.feedback-reason.no-thanks').fadeIn(); }); }); <!-- End Feedback Script -->
Could this be because we are piggy-backing on top of a Marketing Google account, and not our own? What am I missing here?Code: Select all
<!-- Google Tag Manager --> (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'<'+l:'';j.async=true;j.src= 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); })(window,document,'script','dataLayer','<actual_code>'; <!-- End Google Tag Manager -->
https://docs.esignlive.com/content/a_es ... esle_6.htm
Also for others having trouble with "dead" buttons when publishing, I had the same issue when I linked the script to the masterpage. Worked fine locally but buttons were unresponsive on the live site. I ended up plonking the code directly inside the masterpage and now it seems fine. I'm not sure if that's a no-no, but it works.