TOLOGIX - ISLG Maintenance

Project dealing with all ongoing maintenance of the current ISLG application (www.investorstatelawguide.com and dev.investorstatelawguide.com).

Home > Global Search > Add Google Analytics event tracking

Assigned to
Anil Vaghela Anil V.

Comments & Events

Ryan Knuth, Customer Support Manager at Industrial
Hi Anil,

We require the following google analytics event tracking code added to the Global Search "GO" and "View results" links. See below for each:

  1. Global Search - GO button
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search'’, 'click'’, 'GO’');”
  2. Global Search - Subject Navigator - View results
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search - Subject Navigator'’, 'click'’, 'View results’');”
  3. Global Search - Article Citator - View results
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search - Article Citator'’, 'click'’, 'View results’');”
  4. Global Search - Jurisprudence Citator - View results
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search - Jurisprudence Citator'’, 'click'’, 'View results’');”
  5. Global Search - Terms & Phrases - View results
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search - Terms & Phrases'’, 'click'’, 'View results’');”
  6. Global Search - Full Text Search - View results
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search - Full Text Search'’, 'click'’, 'View results’');”
  7. Global Search - Treaties & Rules - View results
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search - Treaties & Rules'’, 'click'’, 'View results’');”
  8. Global Search - Dispute Documents - View results
    onClick=”ga(‘'send'’, ‘'event'’, '‘Global Search - Dispute Documents'’, 'click'’, 'View results’');”
Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

I am looking into this and will update you soon.
Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

We have set the google analytics event tracking code on above suggested places and uploaded on both dev.islg and www.islg.
Ryan Knuth, Customer Support Manager at Industrial
Hi Harsh Parikh, Tech Lead at DevIT Harsh  

I've tested on www.islg but I can't see any events appearing in Google Analytics. It looks like the code is correct, but for some reason it's not making it to GA. Could you please take a look from your end to see if there are any JS errors, mismatched quotes or anything?

Thanks!

Ryan
Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

Due to event tracking code, when we clicks on GO button then we produce the following error in console.

stats.g.doubleclick.net/r/collect?v=1&aip=1&t=dc&_r=3&tid=UA-97262363-2&cid=248706199.1531146385&jid=754914348&_gid=702119705.1534746893&gjid=1794933035&_v=j68&z=1366221475:1 GET https://stats.g.doubleclick.net/r/collect?v=1&aip=1&t=dc&_r=3&tid=UA-97262363-2&cid=248706199.1531146385&jid=754914348&_gid=702119705.1534746893&gjid=1794933035&_v=j68&z=1366221475 0 ()

We did some R&D and fond the following solution. Please perform following step and check once again.

GA -> Admin -> Tracking info -> Data Collection -> disable both toggles and click on save. It can take up to 24 hours for the changes to take effect.

Please refer following URL to perform above steps .
https://tonnygaric.com/blog/prevent-google-analytics-from-making-requests-to-stats-g-doubleclick-net
Ryan Knuth, Customer Support Manager at Industrial
Great, thanks Harsh Parikh, Tech Lead at DevIT Harsh

I've disabled the toggles and I'll check in later.

Ryan
Ryan Knuth, Customer Support Manager at Industrial
Hi Harsh Parikh, Tech Lead at DevIT Harsh  

It looks like the events still aren't getting recorded in GA. Are there any other errors you see when clicking on those links?

Ryan
Ryan Knuth, Customer Support Manager at Industrial
Hi Harsh Parikh, Tech Lead at DevIT Harsh  

We're still using analytics.js so the format should be OK. I'll run it by one of our devs who usually does our GA implementations to see if I've structured the code incorrectly or something.

Thanks!

Ryan
Harsh Parikh, Tech Lead at DevIT
OK Thanks Ryan Knuth, Customer Support Manager at Industrial Ryan .
Ryan Knuth, Customer Support Manager at Industrial
Hi Harsh Parikh, Tech Lead at DevIT Harsh

I've had a developer do some troubleshooting with the code locally and he's recommended a few updates:

GO button
onclick="ga('send', 'event', 'Global Search', 'click', 'GO');">

View results links
onclick="ga('send', 'event', 'Global Search - <ADD TOOL NAME HERE>', 'click', 'View results');">

GA script
  <!-- Google Analytics -->
  <script>
      (function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
      function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
      e=o.createElement(i);r=o.getElementsByTagName(i)[0];
      e.src='//www.google-analytics.com/analytics.js';
      r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
      ga('create','UA-97262363-2');ga('send','pageview');
  </script>


Could you please try this updated code on dev.islg and I'll re-test?

Thanks!

Ryan
Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

We have updated the above code and uploaded on dev.islg.
Please check and let us know the feedback.
Ryan Knuth, Customer Support Manager at Industrial
Hi Harsh Parikh, Tech Lead at DevIT Harsh

The "GO" button is working now, however, the View Results links still are not. I noticed some slight differences between the onclicks on the Go and View Results. Please adjust the View Results ones to the following:

onClick -> onclick
quotes -> Update onclick opening and closing quotes to ""

onclick="ga(‘'send'’, ‘'event'’, '‘Global Search - Subject Navigator'’, 'click'’, 'View results’');">       View results </a>
Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

We have updated View Result links on dev.islg. Please check and confirm.
Ryan Knuth, Customer Support Manager at Industrial
Looking good on dev.islg Harsh Parikh, Tech Lead at DevIT Harsh .

There's just one edit to make for the Article Citator View results link - currently the onclick label says "Global Search - Subject Navigator." Please update to "Global Search - Article Citator."

Once you've made that edit you can push the changes to www.islg.

Thanks!

Ryan

Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

We have changed Article Citator View result link label and uploaded on dev.islg.

We have also migrated all changes on www.islg. Please check and confirm.
Ryan Knuth, Customer Support Manager at Industrial
Working well on www.islg now, thanks Harsh Parikh, Tech Lead at DevIT Harsh .

There's one very minor adjustment to make for the Jurisprudence Citator. An extra ' is appearing in the Category for this link. See screenshot.

Stefanie Gibson, UX Researcher at Industrial
hey all, 
Looking at the analytics, this looks good to me now other than the added apostrophe? Just wondering which day we started tracking the events on? 
Ryan Knuth, Customer Support Manager at Industrial
Would've been tracking reliably since early yesterday morning.
Stefanie Gibson, UX Researcher at Industrial 👌
Morgan Maguire, CEO
Great. Thanks Ryan Knuth, Customer Support Manager at Industrial Ryan and Harsh Parikh, Tech Lead at DevIT Harsh . For getting this setup. Shall I mark this to compete?

Also, Ryan Knuth, Customer Support Manager at Industrial Ryan , perhaps we can discuss an issue I'm having with setting up a goal on GA that tracks how often trial account requests are submitted. I used to have this setup properly, but it appears I'm having difficulty doing this with the new site.

Morgan 
Stefanie Gibson, UX Researcher at Industrial
I just took a quick look and it should be fixed now. Ryan - let me know. 
Ryan Knuth, Customer Support Manager at Industrial
Looks like the goal is working for me now. Thanks Stefanie Gibson, UX Researcher at Industrial Stefanie !
Ryan Knuth, Customer Support Manager at Industrial
Morgan Maguire, CEO Morgan  After you've confirmed the GA fixes you can mark this complete.
Morgan Maguire, CEO
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

Let's plan to go through this on Tuesday, because I uncertain how I test whether the fixes are complete. Note I'm not seeing the URL change when performing a Global Search on dev.islg. Isn't that a basic requirement in how this whole thing will work?

Morgan
Ryan Knuth, Customer Support Manager at Industrial
Sounds good Morgan Maguire, CEO Morgan . We've been able to track Global Search usage without the URL change via GA Event tracking. I'll show you how to test in Real Time, and the Events area of GA.

Ryan
Morgan Maguire, CEO
I see. Sounds good. Look forward to learning more on Tuesday.

Morgan
Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

We have removed an extra ' from the Jurisprudence link on both dev.islg and www.islg. Please check and confirm.
Ryan Knuth, Customer Support Manager at Industrial
Looks good, thanks Harsh Parikh, Tech Lead at DevIT Harsh .

Ryan
Ryan Knuth, Customer Support Manager at Industrial
Hi Harsh Parikh, Tech Lead at DevIT Harsh

When looking at the data yesterday I noticed that the label for the "View results" link is "GO" rather than "View results." Could you please update that in the onclicks for the View results links? The GO button can remain the same.

Thanks!

Ryan

Harsh Parikh, Tech Lead at DevIT
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

We have replaced label name "Go" to "View results" on both dev.islg and www.islg. Please check and confirm.
Ryan Knuth, Customer Support Manager at Industrial
Thanks Harsh Parikh, Tech Lead at DevIT Harsh . I've confirmed the updated labels. I haven't seen one of these updated events come through to Google Analytics yet, so I'll keep an eye on it.

Ryan
Morgan Maguire, CEO
Hi Ryan Knuth, Customer Support Manager at Industrial Ryan ,

What's the latest on this to-do? Is everything resolved yet? Note it looks like the goals in GA are setup properly now. All the conversions are flowing through the signup page.

Thanks,

Morgan
Ryan Knuth, Customer Support Manager at Industrial
Hi Morgan Maguire, CEO Morgan ,

My apologies, I thought I had closed the loop on this. The event tracking for Global Search looks good in prod, and the goal adjustment looks good to me as well. I'll go ahead and mark this complete.

Thanks!

Ryan
Ryan Knuth, Customer Support Manager at Industrial
Ryan Knuth completed this to-do.
Morgan Maguire, CEO
Great. Thanks Ryan Knuth, Customer Support Manager at Industrial Ryan .

Morgan