beyonk-group / svelte-google-analytics

Google Analytics component for Svelte
77 stars 12 forks source link

Add setConfig event/function #26

Closed dextermb closed 2 years ago

dextermb commented 2 years ago

In this pull request I have also tidied up the generator script, and re-ran it, this means that any of the functions added previously directly to the generated scripts file have been moved into the generator.

A new banner has been added to the generated scripts file to discourage people from directly editing it:

/**
 * ------------------------------------------------------------
 * GENERATED FILE. DO NOT DIRECTLY EDIT
 * ------------------------------------------------------------
 **/

Also, the scraper had stopped working. It seems like params have been moved to separate pages and not all pages are in the same format, therefore I have instead provided a link to the documentation per event:

  /**
   * a user joins a group to measure the popularity of each group
   * @see https://developers.google.com/analytics/devguides/collection/ga4/reference/events#join_group
   **/

Unfortunately that also means this PR should be considered breaking as params are now an object rather than arguments:

joinGroup: function eventName (group_id, send_to) {
  addEvent('join_group', { group_id, send_to })
},

now

  /**
   * a user joins a group to measure the popularity of each group
   * @see https://developers.google.com/analytics/devguides/collection/ga4/reference/events#join_group
   **/
  joinGroup: function eventName (params = {}) {
    addEvent('join_group', params)
  },