Adding Feedback widget to topics

This forum is for all Flare issues not related to any of the other categories.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

AlexFox wrote:
Dave Lee wrote:...
Hi Dave, I love this set-up and I've tried to implement something similar but I seem to get an error after clicking Yes or No;

Code: Select all

Running command: ga("send", "event", "Feedback - Yes", "N/A", "http://mypage.com")
Command ignored. Unknown target: undefined
I've completed all of the google analytic setup prerequisites and I'm using google analytic debugger so I can see it's functioning correctly in all other aspects..

Does your version of this still work? Has anyone else had a similar problem?

Thanks!
In around August 2017, Google changed the tracking code from the "ga" format to a new "gtag" format.

My example uses the older "ga" tracking code format. This is still supported by Google, so my original script still works - obviously only if you're using the "ga" format tracking code.

If you're just getting your GA tracking code now, it'll be provided in the new "gtag" format.
So if you're using "gtag", the script needs to send the event information using gtag() rather than ga().

Code: Select all

$(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();
	});
		
});
The prerequisites for using either "ga" or "gtag" is that this analytics tracking code is run prior to my script.
AlexFox
Sr. Propeller Head
Posts: 149
Joined: Thu Oct 19, 2017 1:56 am

Re: Adding Feedback widget to topics

Post by AlexFox »

Thanks for the super prompt reply Dave, I inspected the page you linked earlier in the thread and amended my ga event to use ga("gtag_UA_XXXXXXX_X.send" ... and this seems to work fine, in that I now actually have events appearing in my analytics!

Thanks again :)
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

AlexFox wrote:Thanks for the super prompt reply Dave, I inspected the page you linked earlier in the thread and amended my ga event to use ga("gtag_UA_XXXXXXX_X.send" ... and this seems to work fine, in that I now actually have events appearing in my analytics!

Thanks again :)
No problem, I just updated my own script from "ga" to "gtag" last week.

The "ga" method is still supported now, but it might not always be, so in the long-term you probably want to move to "gtag".
bunnycat
Propeller Head
Posts: 70
Joined: Tue Nov 03, 2015 6:44 am

Re: Adding Feedback widget to topics

Post by bunnycat »

Thank you all, so much for this thread!

I was banging my head against why one of our Help systems posted events to GA, and one didn't. It was because one was under the old ga and the other was under gtag! My script was using ga when it should have used gtags.

EDIT: After updating my site with the gtag events as in the code snippets from Dave - it still isn't submitting anything to GA as events...
I've tried diagnosing using the GA debugger for Chrome, and I don't see any overt errors...
I've reviewed all of the material in the GA developers guide on Event tags but it doesn't seem like anything is incorrect. I'm giving up for tonight before my head explodes.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

bunnycat wrote:Thank you all, so much for this thread!

I was banging my head against why one of our Help systems posted events to GA, and one didn't. It was because one was under the old ga and the other was under gtag! My script was using ga when it should have used gtags.

EDIT: After updating my site with the gtag events as in the code snippets from Dave - it still isn't submitting anything to GA as events...
I've tried diagnosing using the GA debugger for Chrome, and I don't see any overt errors...
I've reviewed all of the material in the GA developers guide on Event tags but it doesn't seem like anything is incorrect. I'm giving up for tonight before my head explodes.
The events code I posted works fine for me.

But before looking at events, make sure your gtag code is being run before the events, and that your gtag code actually works and is sending page views.

When you copy/past the gtag tracking code directly from Google, you have to edit part of it, so that it's valid XHTML.
In the first 'script' line, edit async to read async=""
Original:

Code: Select all

<script async src="https://www.googletagmanager.com/gtag/js?id=xx-xxxxxxxx-x">
Change to:

Code: Select all

<script async="" src="https://www.googletagmanager.com/gtag/js?id=xx-xxxxxxxx-x">
bunnycat
Propeller Head
Posts: 70
Joined: Tue Nov 03, 2015 6:44 am

Re: Adding Feedback widget to topics

Post by bunnycat »

Dave Lee wrote:
bunnycat wrote:Thank you all, so much for this thread!

I was banging my head against why one of our Help systems posted events to GA, and one didn't. It was because one was under the old ga and the other was under gtag! My script was using ga when it should have used gtags.

EDIT: After updating my site with the gtag events as in the code snippets from Dave - it still isn't submitting anything to GA as events...
I've tried diagnosing using the GA debugger for Chrome, and I don't see any overt errors...
I've reviewed all of the material in the GA developers guide on Event tags but it doesn't seem like anything is incorrect. I'm giving up for tonight before my head explodes.
The events code I posted works fine for me.

But before looking at events, make sure your gtag code is being run before the events, and that your gtag code actually works and is sending page views.

When you copy/past the gtag tracking code directly from Google, you have to edit part of it, so that it's valid XHTML.
In the first 'script' line, edit async to read async=""
Original:

Code: Select all

<script async src="https://www.googletagmanager.com/gtag/js?id=xx-xxxxxxxx-x">
Change to:

Code: Select all

<script async="" src="https://www.googletagmanager.com/gtag/js?id=xx-xxxxxxxx-x">
Dave, thank you for the extra information. I really appreciate it. Yes my gtag code is being run before the events, and we can see page views for that help system, so that section must be working.

I knew about the async issue because Flare build complains about it, but I guess I added the wrong parameter to async. I will try your suggestions. Thank you very much.
Keith_Marion
Jr. Propeller Head
Posts: 2
Joined: Fri Apr 13, 2018 10:37 am

Re: Adding Feedback widget to topics

Post by Keith_Marion »

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:

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>
My feedback 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 -->
And my Google Tag manager script:

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 -->
Could this be because we are piggy-backing on top of a Marketing Google account, and not our own? What am I missing here?

https://docs.esignlive.com/content/a_es ... esle_6.htm
bunnycat
Propeller Head
Posts: 70
Joined: Tue Nov 03, 2015 6:44 am

Re: Adding Feedback widget to topics

Post by bunnycat »

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:

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>
My feedback 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 -->
And my Google Tag manager script:

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 -->
Could this be because we are piggy-backing on top of a Marketing Google account, and not our own? What am I missing here?

https://docs.esignlive.com/content/a_es ... esle_6.htm
I don't know if it helps much, but the Chrome Google Analytics Tag Assistant extension (debugger) shows an exception when clicking your feedback button:

Code: Select all

Uncaught ReferenceError: gtag is not defined
    at HTMLAnchorElement.<anonymous> (google-analytics-events.js:14)
    at HTMLAnchorElement.dispatch (jquery.min.js:8)
    at HTMLAnchorElement.r.handle (jquery.min.js:8)
(anonymous) @ google-analytics-events.js:14
dispatch @ jquery.min.js:8
r.handle @ jquery.min.js:8
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

Keith_Marion wrote:Could this be because we are piggy-backing on top of a Marketing Google account, and not our own? What am I missing here?
The examples here are for using the Google Analytics code - either using the older 'ga' or newer 'gtag' flavours.

Your code for Google Tag Manager appears to be different to what's provided by Google Analytics.
Sorry, but I've no idea how that works, I've only used Google Analytics code.
davidgolden99
Propeller Head
Posts: 29
Joined: Thu Apr 10, 2008 11:17 am

Re: Adding Feedback widget to topics

Post by davidgolden99 »

I'm late to the party, but I've discovered -- as has been mentioned in other threads -- that Flare 2017 and later breaks JS. I tried to implement Dave's code, only to find that I have dead "Yes" and "No" links. Is there a workaround to get the script to execute? For the moment, I'm using the code snippets exactly as Dave posted them.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

davidgolden99 wrote:I'm late to the party, but I've discovered -- as has been mentioned in other threads -- that Flare 2017 and later breaks JS. I tried to implement Dave's code, only to find that I have dead "Yes" and "No" links. Is there a workaround to get the script to execute? For the moment, I'm using the code snippets exactly as Dave posted them.
Nope - Flare 2017 doesn't break the JS at all.
I use this code in my projects and it works fine in Flare 2017 and 2018.

The only change I've made to my own javascript is moving from Google Analytics "ga" code (in my original post) to "gtag" code (which I've described later in this thread).

Bear in mind that Google Analytics must be run before this script (and work).
jsandora
Propeller Head
Posts: 94
Joined: Thu Jun 23, 2011 5:56 am
Location: Boston, MA

Re: Adding Feedback widget to topics

Post by jsandora »

General question about adding this feedback to topics:

Am I correct that this needs to be deployed to an actual server in order to test out the JS and Analytics portion of the setup?

I've added the necessary code everywhere (HTML to Masterpages, CSS to Stylesheet, and JS file to Project). I'm able to see the initial feedback question on my local machine when I build out the project. BUT, the buttons themselves don't do anything. Clicking No doesn't open the follow-up response options, and Yes doesn't show the Thank You message. Is that just because it's on my local machine?
Software Documentation Specialist (but really, Tech Writer)
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

jsandora wrote:General question about adding this feedback to topics:

Am I correct that this needs to be deployed to an actual server in order to test out the JS and Analytics portion of the setup?

I've added the necessary code everywhere (HTML to Masterpages, CSS to Stylesheet, and JS file to Project). I'm able to see the initial feedback question on my local machine when I build out the project. BUT, the buttons themselves don't do anything. Clicking No doesn't open the follow-up response options, and Yes doesn't show the Thank You message. Is that just because it's on my local machine?
Clicking No should display the questions, whether or not you've set up analytics.

When you set up analytics, you specifed the website URL. Google Analytics will only collect data that originates from that URL/domain. So you'll only see your analytics being recorded once you've deployed it to your server and you test it from that server/domain.

My javascript for sending the events is different, depending on your version of Google Analytics code - ga or gtag. If you got your GA code before Aug 2017 (in the old ga format), then go to the GA site and get your current tracking code in gtag format, and use that instead. I posted an updated version of my events javascript in this thread that works with GA's gtag code.

My advice would be to set up analytics and get that working first - e.g. test it recording page views. Once you've got GA working, then add my code to record the events, and make sure it runs after GA's code.
joshua_cline
Propeller Head
Posts: 35
Joined: Mon Jun 25, 2018 8:45 am

Re: Adding Feedback widget to topics

Post by joshua_cline »

I've added the HTML, javascript, and CSS from Dave's code, however, when I select Yes or No, nothing happens. What did I do wrong? Is there something else I need to add to make this work?

Thank you
joshua_cline
Propeller Head
Posts: 35
Joined: Mon Jun 25, 2018 8:45 am

Re: Adding Feedback widget to topics

Post by joshua_cline »

Nevermind. I figured it out.
bunnycat
Propeller Head
Posts: 70
Joined: Tue Nov 03, 2015 6:44 am

Re: Adding Feedback widget to topics

Post by bunnycat »

Has anyone experienced any negative effects from upgrading Flare to Flare 2019 R2 with their Google Analytics feedback code.

My feedback code (from the previous examples here) was working great - right up to the Flare 2019 R2 upgrade. After I upgraded, had several problems with my TopNav site - it wouldn't display the Top menu reliably, any miniTOC menu proxies in topics disappeared, and the search functionality in Flare returned weird search results for things that worked before the upgrade. Of course, it only exhibited on the live production servers, not in local builds. :(

The support ticket I opened bounced around with Flare support - the support representative finally ripped out my google analytics feedback code and Flare 2019 R2 worked with my site.

The support rep hypothesized that there might be a jquery conflict with my code and their newly-updated jquery version in Flare 2019 R2 and recommended that I rewrite my scripts to deal with it.

Which is going to take some experimenting because I'm only an novice/average jquery script writer.

Thanks!!

-CAT
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

I'm still using the feedback code I posted here, and it works fine in 2019r2.

If your code works in local builds and only fails in the live production server, then to me that suggests the issue is your server and not the code.

Quite surprised that support suggested it was your jquery, because that presumably works on your local builds.

I see these issues quite frequently in my company, as we use a server-side cache on our websites. After I publish an output to the server, HTML files are refreshed instantly in the server-side cache, but JS and CSS files can take 1-2 hours to be refreshed. So this means that you see some pretty unpredictable behaviour during this period, as you get the new HTML but the old JS/CSS. It took me a while to discover what was happening, and I had to ask around the folks that manage our servers to discover what was causing it.

So my advice is to leave your code alone, and ask the folks at your company why it's not working on the server.
bunnycat
Propeller Head
Posts: 70
Joined: Tue Nov 03, 2015 6:44 am

Re: Adding Feedback widget to topics

Post by bunnycat »

Dave Lee wrote:I'm still using the feedback code I posted here, and it works fine in 2019r2.

If your code works in local builds and only fails in the live production server, then to me that suggests the issue is your server and not the code.

Quite surprised that support suggested it was your jquery, because that presumably works on your local builds.

I see these issues quite frequently in my company, as we use a server-side cache on our websites. After I publish an output to the server, HTML files are refreshed instantly in the server-side cache, but JS and CSS files can take 1-2 hours to be refreshed. So this means that you see some pretty unpredictable behaviour during this period, as you get the new HTML but the old JS/CSS. It took me a while to discover what was happening, and I had to ask around the folks that manage our servers to discover what was causing it.

So my advice is to leave your code alone, and ask the folks at your company why its not working on the server.
Thank you Dave - We've run into that caching issue before on the Akamai edge servers, so we purge cache as part of our normal maintenance whenever we publish. It also happened when I published to our doc testing IIS server (I know it's a different tech stack) but that had the exact same issues. I'll try that again with a little more discernment on what's getting cleaned or not.

I'll bash my head against it for today - maybe I can take things apart and do line-by-line redo of the feedback widget.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Adding Feedback widget to topics

Post by NorthEast »

Are there no clues from errors in the browser Console?
bunnycat
Propeller Head
Posts: 70
Joined: Tue Nov 03, 2015 6:44 am

Re: Adding Feedback widget to topics

Post by bunnycat »

Dave Lee wrote:Are there no clues from errors in the browser Console?
Yes, there were a couple of warnings in GA's debugger (that were benign and known), plus one enormous stack from require.min.js. So large of a stacktrace, I cannot really tell what is wrong.

So I'm going through all of my feedback jquery and GA/Gtag code bits, to make sure I've cleaned out any hints of errors or warnings shown the GA debugger, before I try upgrading to Flare 2019 R2 again.
amitkapoor
Propeller Head
Posts: 33
Joined: Mon Sep 16, 2019 5:23 am

Re: Adding Feedback widget to topics

Post by amitkapoor »

ChoccieMuffin wrote:We have a "FEEDBACK" link on the bottom of all our help topics, which sends an email to us with the comments. It's most commonly used internally by colleagues noticing something simple (like a typo or punctuation error), but sometimes external clients do use it.

The code used for it is this:

<script type="text/javascript">/*<![CDATA[*/document.write("<a href='mailto:OUR EMAIL ADDRESS?subject=Customer%20Feedback%20("+document.title+")%20Build:%2014927&body=Topic%20Reference%20(XXXXX%20use%20only):%20"+location.href+"%0A%0APlease%20enter%20your%20comments%20below:%0A%0A'>FEEDBACK</a>")

That bit of code is inserted at the bottom of the MasterPage used in our help. (Bits in blue are bits you would have to customise yourself.)

Hope that helps.
The correct code just in case anyone misses it is:

Code: Select all

<script type="text/javascript">/*<![CDATA[*/document.write("<a href='mailto:OUR EMAIL ADDRESS?subject=Customer%20Feedback%20("+document.title+")%20Build:%2014927&body=Topic%20Reference%20(XXXXX%20use%20only):%20"+location.href+"%0A%0APlease%20enter%20your%20comments%20below:%0A%0A'>FEEDBACK</a>");/*]]>*/</script>
ArdisRamey
Propeller Head
Posts: 54
Joined: Wed Sep 05, 2018 9:04 am

Re: Adding Feedback widget to topics

Post by ArdisRamey »

amitkapoor wrote:
ChoccieMuffin wrote:We have a "FEEDBACK" link on the bottom of all our help topics, which sends an email to us with the comments. It's most commonly used internally by colleagues noticing something simple (like a typo or punctuation error), but sometimes external clients do use it.

The code used for it is this:

<script type="text/javascript">/*<![CDATA[*/document.write("<a href='mailto:OUR EMAIL ADDRESS?subject=Customer%20Feedback%20("+document.title+")%20Build:%2014927&body=Topic%20Reference%20(XXXXX%20use%20only):%20"+location.href+"%0A%0APlease%20enter%20your%20comments%20below:%0A%0A'>FEEDBACK</a>")

That bit of code is inserted at the bottom of the MasterPage used in our help. (Bits in blue are bits you would have to customise yourself.)

Hope that helps.
The correct code just in case anyone misses it is:

Code: Select all

<script type="text/javascript">/*<![CDATA[*/document.write("<a href='mailto:OUR EMAIL ADDRESS?subject=Customer%20Feedback%20("+document.title+")%20Build:%2014927&body=Topic%20Reference%20(XXXXX%20use%20only):%20"+location.href+"%0A%0APlease%20enter%20your%20comments%20below:%0A%0A'>FEEDBACK</a>");/*]]>*/</script>
Sorry, maybe I'm being obtuse here but can anyone help me understand what the second variable is in this bit of code? I'd like to implement this solution, but can't suss out what (XXXXX%20use%20only) is referring to, and therefore what information I should be subbing in there.

Thanks!
zappy0
Propeller Head
Posts: 37
Joined: Fri Mar 25, 2016 2:19 pm

Re: Adding Feedback widget to topics

Post by zappy0 »

In that code, you are constructing an email. There are three parameters being provided: mailto (the email address you want the feedback sent to), Subject (for the Subject line), and Body (the content of the email). The subject and body can be anything you want. %20 represents a space. The sample includes some variables available from the browser such as document.title and location.href - these will allow you to tie a reader's comments to a specific page in your documentation. (XXXXX%20use%20only) isn't really important to making this work. You can just use "....documentation%20use%20only..." to at least get a working example. As a side note, I didn't know if my readers would have an email client on their devices that would accept this script, and I didn't want to gain any personally identifying information about them. so I used an API call instead. elasticemail.com provides a free version and it has been reliable for me. Let me know if I have misunderstood your question and I'll do some more digging.
ArdisRamey
Propeller Head
Posts: 54
Joined: Wed Sep 05, 2018 9:04 am

Re: Adding Feedback widget to topics

Post by ArdisRamey »

zappy0 wrote:In that code, you are constructing an email. There are three parameters being provided: mailto (the email address you want the feedback sent to), Subject (for the Subject line), and Body (the content of the email). The subject and body can be anything you want. %20 represents a space. The sample includes some variables available from the browser such as document.title and location.href - these will allow you to tie a reader's comments to a specific page in your documentation. (XXXXX%20use%20only) isn't really important to making this work. You can just use "....documentation%20use%20only..." to at least get a working example. As a side note, I didn't know if my readers would have an email client on their devices that would accept this script, and I didn't want to gain any personally identifying information about them. so I used an API call instead. elasticemail.com provides a free version and it has been reliable for me. Let me know if I have misunderstood your question and I'll do some more digging.
That's very helpful context. Thanks!
ChoccieMuffin
Senior Propellus Maximus
Posts: 2630
Joined: Wed Apr 14, 2010 8:01 am
Location: Surrey, UK

Re: Adding Feedback widget to topics

Post by ChoccieMuffin »

ArdisRamey wrote:
amitkapoor wrote:
ChoccieMuffin wrote:We have a "FEEDBACK" link on the bottom of all our help topics, which sends an email to us with the comments. It's most commonly used internally by colleagues noticing something simple (like a typo or punctuation error), but sometimes external clients do use it.

The code used for it is this:

<script type="text/javascript">/*<![CDATA[*/document.write("<a href='mailto:OUR EMAIL ADDRESS?subject=Customer%20Feedback%20("+document.title+")%20Build:%2014927&body=Topic%20Reference%20(XXXXX%20use%20only):%20"+location.href+"%0A%0APlease%20enter%20your%20comments%20below:%0A%0A'>FEEDBACK</a>")

That bit of code is inserted at the bottom of the MasterPage used in our help. (Bits in blue are bits you would have to customise yourself.)

Hope that helps.
The correct code just in case anyone misses it is:

Code: Select all

<script type="text/javascript">/*<![CDATA[*/document.write("<a href='mailto:OUR EMAIL ADDRESS?subject=Customer%20Feedback%20("+document.title+")%20Build:%2014927&body=Topic%20Reference%20(XXXXX%20use%20only):%20"+location.href+"%0A%0APlease%20enter%20your%20comments%20below:%0A%0A'>FEEDBACK</a>");/*]]>*/</script>
Sorry, maybe I'm being obtuse here but can anyone help me understand what the second variable is in this bit of code? I'd like to implement this solution, but can't suss out what (XXXXX%20use%20only) is referring to, and therefore what information I should be subbing in there.

Thanks!
I substituted XXXXX with the company name, so the content of a typical email sent from our feedback button looks like this:

Topic Reference ([[[Company name]]] use only): mk:@MSITStore:C:\[[[file path to the chm]]]::/[[[path in my Flare project]]]\[[[topic name]]].html
Please enter your comments below:

where the bits inside [[[ and ]]] in the example above are shown as they are. So in the code I gave, write your company name, and I have other scripts (that run elsewhere in my build process) that substitute the build number in the message subject.
Feedback email.png
You do not have the required permissions to view the files attached to this post.
Started as a newbie with Flare 6.1, now using Flare 2023.
Report bugs at http://www.madcapsoftware.com/bugs/submit.aspx.
Request features at https://www.madcapsoftware.com/feedback ... quest.aspx
Post Reply