FoxInCloud
Google analytics
Gravatar is a globally recognized avatar based on your email address. Google analytics
  Vincent H.
  All
  Jun 7, 2018 @ 06:13am

Hi Thierry,

The following code must be inserted right after the <head> tag

<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'GA_TRACKING_ID');
</script>

.cScriptJSAdd_ () inserts at the end. What is the best way to insert this code in the right place?

Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 7, 2018 @ 09:40am

As this is HTML, .cScriptJSAdd*() can't be used

IMO it should come right before </body> after the other <script> tags

Where do you read it should be right after the <head> tag?

Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 7, 2018 @ 09:55am

In google documentation.
Here: https://support.google.com/analytics/answer/1008080?hl=fr

Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 7, 2018 @ 10:26am

There is nothing specific for that, however this should work (replace &lt;by <):

modify command xxxServer

define class xxxProcess
…

&& add this:
* ------------------------------------------------------------
protected function wFormStandardPage_cMetaTagsAdd && {en} additional meta tags for your standard page

&& {en} Implement / override in your subclass xxxProcess
&& {fr} Implementez / surchargez dans votre sous-classe xxxProcess

local lcHTML, GA_TRACKING_ID
GA_TRACKING_ID = "… your site key …"

text to lcHTML textmerge noshow flag 1
<!-- Global Site Tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=<<GA_TRACKING_ID>>"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', '<<GA_TRACKING_ID>>');
</script>
endtext

return m.lcHTML
encfunc
Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 7, 2018 @ 10:53am

Oups ... "la fusion de texte est récursive"

Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 7, 2018 @ 10:56am
lcHTML = '';
 + "<!-- Global Site Tag (gtag.js) - Google Analytics -->" + CRLF;
 + [<script async src="https://www.googletagmanager.com/gtag/js?id=] + GA_TRACKING_ID + ["></script>] + CRLF;
 + …
Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  Vincent H.
  FoxInCloud Support - Thierry N.
  Jun 7, 2018 @ 11:23am

not better. I commented on my code for a new update

Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 7, 2018 @ 12:05pm

what do you mean? What error? This is unclear

Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  Vincent H.
  Vincent H.
  Jun 7, 2018 @ 12:20pm

I tried this code, without success:

PROTECTED FUNCTION wFormStandardPage_cMetaTagsAdd && {en} additional meta tags for your standard page
&& {en} Implement / override in your subclass xxxProcess
&& {fr} Implementez / surchargez dans votre sous-classe xxxProcess

LOCAL lcHTML, GA_TRACKING_ID
GA_TRACKING_ID = "U ... "
TEXT TO lcHTML TEXTMERGE NOSHOW FLAGS 1
   <!-- Global Site Tag (gtag.js) - Google Analytics -->
   <script async src="https://www.googletagmanager.com/gtag/js?id=<<GA_TRACKING_ID>>"></script>
   <script>
     window.dataLayer = window.dataLayer || [];
     function gtag(){dataLayer.push(arguments);}
     gtag('js', new Date());

     gtag('config', '<<GA_TRACKING_ID>>');
   </script>
ENDTEXT
RETURN CHR(0) + m.lcHTML
ENDFUNC

Gravatar is a globally recognized avatar based on your email address. re: Google analytics
  FoxInCloud Support - Thierry N.
  Vincent H.
  Jun 7, 2018 @ 12:34pm

you need to replace text to lcHTMLendtext by lcHTML = '<!--- …' + '…'

© 1996-2024