Jump to content

Search the Community

Showing results for tags 'matomo'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Calendars

  • Community Calendar

Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 2 results

  1. Please find below the Javascript insertion <script> tag that Matomo uses to track user behavior on a webpage. <!-- Matomo --> <script type="text/javascript"> var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//{$PIWIK_URL}/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', {$IDSITE}]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code --> I would like to clarify the meaning of the final line of the above function -- namely, g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); QUESTION ONE: Can the script attributes async and defer work indepedently of each another? What is the purpose of each and does their role change when they are imlpemented together? QUESTION TWO: Given the statement s=d.getElementsByTagName('script')[0]; does the statement s.parentNode.insertBefore(g,s); read: "Find the parent node of s and prepend g before s where s is the first node of all script nodes within the document including the node containing this function"?
  2. Understanding Matomo

    Although by no means fully recovered from a recent machine failure, I am back on the road in a much weakened condition. Please consider the following piece of code and correct me where my interpretation of the code is in error. <!-- Matomo --> <script type="text/javascript"> var _paq = _paq || []; _paq.push(['trackPageView']); _paq.push(['enableLinkTracking']); (function() { var u="//{$PIWIK_URL}/"; _paq.push(['setTrackerUrl', u+'piwik.php']); _paq.push(['setSiteId', {$IDSITE}]); var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Matomo Code --> My interpretation of same var _paq = _paq || []; _paq is an array that is initialized as empty or some preassigned value. _paq.push(['trackPageView']); Add a new element to _paq whose key-value pair is 'trackPageView' : undefined var u="//{$PIWIK_URL}/"; Create a variable called called u and assign to it the following string "// + some.domain.name + /". _paq.push(['setTrackerUrl', u+'piwik.php']); Add a new element to _paq whose key-value pair is 'setTrackerUrl' and u + piwik.php, respectively. var d=document, g=d.createElement('script'),s=d.getElementsByTagName('script')[0]; Create three variables named d, g and s whose values are d: the DOM document g: the name of a newly created element called 'script' s: an empty index array called 'script' g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); The resulting script tag should appear as follows: <script text='javascript' async='true' defer='true' src= 'u + piwik.js'></script> function()(); Run the function upon loading the document in which it is contained. Roddy
×