Fire a custom event when the DAP script loads. #147
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This is a proposed change to fire a custom event when the universal federated analytics script is loaded. The reason for this is because DAP advises its users to load the script as
async, and there are scenarios where a consumer of the DAP script also would like to callgas4to send other event details.Since the
gas4function is defined by the Universal-Federated-Analytics script, there is potential to have JS errors if the call to thegas4function is made before the Universal-Federated-Analytics script loads. Since the Universal-Federated-Analytics is defined asasync, there is currently no way to make sure thegas4function can be called reliably due to how the browser loads script files with theasyncattribute.Adding the custom event as proposed would allow consumers of the script to call the
gas4function after it has been defined.