We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25124
    • 54 Posts
    Hi,

    I would like my eForm ’Report’ page (e.g. the page that confirms the form has been filled out and sent by the visitor) to contain a Goal code for Google Analytics.

    The problem is that the page has no different URL from the form itself and I’m struggling to find a way to solve this.

    Usually you would put in a URL (e.g. the thanks-for-submitting-the-form-page.htm or similar) into the Goal tracking URL of Analytics and this would then trigger on it being called.

    This isn’t the case in my situation and in ModX obviously!

    I have read here;

    https://www.google.com/support/googleanalytics/bin/answer.py?answer=55576

    That I may need to use an ’urchinTracker JavaScript function’

    From what I gather, you put some javascript in the top of the page/form and then call it from within the Report element of the eForm.

    This is where I get stuck huh

    Would someone be able to take a look for me and advise?

    Also I need to note:
    Important: If your pages include a call to urchinTracker(), utmLinker(), utmSetTrans() or utmLinkPost(), your Analytics tracking code must be placed in your HTML code above any of these calls.

    Thanks so much in advance
      • 17883
      • 1,039 Posts
      Use the &gotoid parameter for redirection to a specific ID (including the google code) after submitting the form
        • 25124
        • 54 Posts
        Thanks make my day, but I get redirected to the thanks page (42) I created without any variables being submitted.

        e.g. I’ve copied the code from the eFeedBackThanks into a new page called thanks (id of 42) - I’ve then added &gotoid=`42` to the form page see below,

        &formid=`eFeedBackForm` &eFormOnBeforeMailSent=`eForm2db` &tpl=`eFeedBackForm` &thankyou=`eFeedBackThanks` &gotoid=`42`


        When the form is submitted I get redirected to the thanks page however it is not filling in the data they requested (e.g. I call in this data so that they can see what they’ve requested) just to double-check.

        Any ideas?

        sad
          • 17883
          • 1,039 Posts
          Please provide your form and thank you template.
          • If you don’t do the redirection, are you getting the thankyou page that you want?
            If so, I can help you customize the urchin tracker call. I echo MadeMyDay’s request to see the thankyou template code.
              Mike Schell
              Lead Developer, MODX Cloud
              Email: [email protected]
              GitHub: https://github.com/netProphET/
              Twitter: @mkschell
              • 25124
              • 54 Posts
              Hi NetProphet and MadmyDay,

              Yes, the form is working perfectly and the
              &thankyou=`eFeedBackThanks`
              efeedbackthanks page is working fine , however the url doesn’t change so google is unable to count it as being a goal.

              eFeedBackForm

              <span style="color:#900;">[+validationmessage+]</span></p>
              <form method="post" action="[~[*id*]~]" enctype="multipart/form-data">
              <input type="hidden" name="formid" value="eFeedBackForm" />
              <p><label accesskey="t" for="Title">Title</label>
                  <select name="Title">
                  <option value="Dr">Dr</option>
                  </select></p>
              
               <p><label accesskey="n" for="Name">Name</label>
               <input type="text" name="Name" size="40" maxlength="60" eform="Your Name:html:0" /></p>
              
               <p><label accesskey="c" for="Company">Company</label>
               <input type="text" name="Company" size="40" maxlength="60" eform="Your Company Name:html:0" /></p>
              
               <p><label accesskey="a" for="Address">Addr</label>
              <textarea cols="30" rows="5" name="Address" eform="Address:html:0" ></textarea></p>
              
               <p><label accesskey="t" for="Telephone">Tel</label>
               <input type="text" name="Telephone" size="40" maxlength="60" eform="Your Telephone Number:html:0" /></p>
              
               <p><label accesskey="f" for="Fax">Facsimile</label>
               <input type="text" name="Fax" size="40" maxlength="60" eform="Your Fax Number:html:0" /></p>
              
              <p><label accesskey="e" for="email">email</label>
              <input type="text" name="email" size="40" maxlength="70" eform="Your Email Address:email:1" /></p>
              
              <p><label accesskey="q" for="Quantity">Qty</label>
              <input type="text" name="Quantity" maxlength="40" eform="Quantity required:html:0" /></p>
              
               
                  <!-- <p>Please enter the anti spam code :  <img src="[+verimageurl+]" alt="verification code" border="1"/> </p>
                  <p>
                  <label accesskey="c" for="vericode"></label>
                  <input type="text" name="vericode" size="20" /><p> -->
              <p><input type="submit" name="submit" value="Submit form" />    </p>
              </form> 




              eFeedBackThanks

              <h2>Your form has been submitted</h2>
              <p>Dear [+Name+],</p>
              <p>Please make sure the <b style="font-weight:bold; font-size:1.3em;color:red;">email address</b> below is correct. If not, please click back and resubmit.</p>
              <p>The details you submitted are:</p>
              <table>
              <tr valign="top"><td>Title:</td><td>[+Title+]</td></tr>
              <tr valign="top"><td>Name:</td><td>[+Name+]</td></tr>
              <tr valign="top"><td>Company:</td><td>[+Company+]</td></tr>
              <tr valign="top"><td>Address:</td><td>[+Address+]</td></tr>
              <tr valign="top"><td>Telephone:</td><td>[+Telephone+]</td></tr>
              <tr valign="top"><td>Fax:</td><td>[+Fax+]</td></tr>
              <tr valign="top"><td>Email:</td><td><b style="font-weight:bold; font-size:1.3em;color:red;">[+email+]</b></td></tr>
              <tr valign="top"><td>Quantity:</td><td>[+Quantity+]</td></tr>
              </table>
              <p> </p>
              
              <!-- Google Code for lead Conversion Page -->
              <script language="JavaScript" type="text/javascript">
              <!--
              var google_conversion_id = ZZZZZZZZ;
              var google_conversion_language = "en_GB";
              var google_conversion_format = "1";
              var google_conversion_color = "AEC9FF";
              if (1) {
                var google_conversion_value = 1;
              }
              var google_conversion_label = "lead";
              //-->
              </script>
              <script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js">
              </script>
              <noscript>
              <img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/ZZZZZZZZ/imp.gif?value=1&label=lead&script=0">
              </noscript>






              • Quote from: SammyR at Dec 07, 2007, 11:00 AM

                ... however the url doesn’t change so google is unable to count it as being a goal.

                The Google Analytics system has a way to get around this which is pretty simple.
                Normally, you call the urchin tracker in your page something like this:
                <script type="text/javascript">
                _uacct = "UA-xxxxxxx-3";
                urchinTracker();
                </script>
                


                and then Google Analytics will use the URL of the page in it’s tracking.

                However, if you supply an alternate name to the urchinTracker function, like this:
                <script type="text/javascript">
                _uacct = "UA-xxxxxxx-3";
                urchinTracker('thankyou-page');
                </script>
                


                then Google Analytics will track the page hit by that name. When you’re looking at your reports, it will be as if there is a page called "thankyou-page" that is tracked separately.

                I don’t know what facility there is using the e-form snippet for accomplishing this. I use my own form processing snippet, and in it I set various placeholders, including the name that I want to send to Google Analytics. In this way, I can track initial form view, form preview (if the form is set up that way), form reload (if user clicks ’back’ from preview page), error page (again, if set up) and thank you. All from the same URL, but tracked separately in GA.

                Anyone know if there is a way to set a placeholder in eForm depending on the stage of the form-filling process that you’re at?
                  Mike Schell
                  Lead Developer, MODX Cloud
                  Email: [email protected]
                  GitHub: https://github.com/netProphET/
                  Twitter: @mkschell
                  • 25124
                  • 54 Posts
                  Thanks netProphet,

                  OK so what I have at the bottom of every page is this code.

                  </div>
                  <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
                  </script>
                  <script type="text/javascript">
                  _uacct = "UA-xxxxxx-x";
                  urchinTracker();
                  </script>
                  </body>
                  </html>


                  Now from what you say, on the eFeedbackThanks page the code should actually read;

                  </div>
                  <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
                  </script>
                  <script type="text/javascript">
                  _uacct = "UA-xxxxxx-x";
                  urchinTracker(thank-you.html);
                  </script>
                  </body>
                  </html>


                  Within my Goal part of Analytics I should set G1 as follows;

                  Goal URL: www.mydomain.com/thank-you.html
                  Goal name: Feedback form filled out OK


                  The only problem I have is that the Analytics code is in the template page of the site so making it different for the eFeedbackThanks page is going to be a problem.

                  What would you recommed I do here? Looking forward to your reply smiley
                  • I’m going to have to dig into the eForm snippet code and see what’s possible.
                    The ideal thing would be to have the snippet set a placeholder for the thankyou page. Not sure if it can be done in eForm, or if not, if it’s best to modify eForm or make a small snippet to run after eForm.
                    By the way, when you provide a label to urchin, there needs to be quotes around it:
                    </div>
                    <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
                    </script>
                    <script type="text/javascript">
                    _uacct = "UA-xxxxxx-x";
                    urchinTracker("thank-you.html");
                    </script>
                    </body>
                    </html>
                    

                    Hopefully I’ll be back after not too long with an idea on how to proceed.
                      Mike Schell
                      Lead Developer, MODX Cloud
                      Email: [email protected]
                      GitHub: https://github.com/netProphET/
                      Twitter: @mkschell
                      • 33372
                      • 1,611 Posts
                      Why don’t you just do something like change your template code to:
                      </div>
                      <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
                      </script>
                      <script type="text/javascript">
                      _uacct = "UA-xxxxxx-x";
                      urchinTracker([*GAgoal*]);
                      </script>
                      </body>
                      </html>

                      and then create a TV called GAgoal where you enter a value when you want that specific page to be tracked?

                      You can set placeholders using eForm functions also, so if you wanted to do that (i.e., to use a thank you chunk instead of a goto page) you could replace [*GAgoal*] with [+GAgoal+] in your template.
                        "Things are not what they appear to be; nor are they otherwise." - Buddha

                        "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options