Skip to content

Releases: aawnu/php-ga4

Add class::fromArray() to Events and Items

19 Nov 19:17
a97aa9c
Compare
Choose a tag to compare

Add import from array to event or item, making it possible to prebuild events on frontend before passing to backend.

axios.post('/api/ga4', {
    addToCart: {
        currency: 'EUR',
        value: 13.37,
        items: [
            {
                'item_id': 1,
                'item_name': 'Cup',
                'price': 13.37,
                'quantity': 1
            }
        ]
    }
})
use AlexWestergaard\PhpGa4\Analytics;
use AlexWestergaard\PhpGa4\Event;

$addToCart = Event\AddToCart::fromArray($_POST['addToCart']);

Analytics::new($measurementId, $apiSecret)->addEvent($addToCart)->post();

What's Changed

  • Add static fromArray() method to Events and Items by @aawnu in #22

Full Changelog: v1.0.8...v1.0.9

Accept responses without body

03 Nov 15:08
Compare
Choose a tag to compare
  • Allow responses without a body (Response 204)
  • Allow decimal numbers for tax and shipment values
  • Update composer links to fit GitHub account renaming

What's Changed

  • Production gives HTTP 204 (no content) on a successful post by @jordykouters in #18
  • The fields "shipping" and "tax" can both be float values by @jordykouters in #19

New Contributors

Full Changelog: v1.0.7...v1.0.8

Preview for Packagist

30 Aug 19:00
Compare
Choose a tag to compare

This update has no functional changes. It's purely to improve information and Packagist

Differentiate between Full and Partial Refund

30 Aug 10:07
01b4bbb
Compare
Choose a tag to compare
  • Added isFullRefund scope to Refund to help determine if Items is a required parameter.

What's Changed

  • Add separator between Refund and Partial Refund by @AlexWestergaard in #17

Full Changelog: v1.0.5...v1.0.6

Clean-up and skip too large requests

28 Aug 02:11
102749d
Compare
Choose a tag to compare

Minor fixup of Analytics::toArray() and skipping post-requests too large (exceeds 130kb body size).

Please refer to the previous release for more details about the last modifications.

Cleaner Exception Handling

28 Aug 01:50
d04a112
Compare
Choose a tag to compare

This update refactors the exception flow of the code in a cleaner and simpler-to-understand way.

The reason for this update is to avoid throwing midways through a process happening on multiple layers, for example $event->toArray()->parent::toArray(). It is also preferable to avoid throwing exceptions when iterating through multiple post-calls due to multiple Event stacks (Each post-call can contain a maximum of 25 events).

Please use the $debug parameter when initializing the Analytics class while configuring your code and events. Just bear in mind that Google Analytics Debug endpoint will only point to direct constraints to their structure and not the data itself.

What's Changed

  • Update Exception Handling by @AlexWestergaard in #15

Full Changelog: v1.0.3...v1.0.4

Fix conversion to micro-time from visual string

25 Aug 09:25
Compare
Choose a tag to compare
  • Updated intval("1_000_000") to intval(strtr("1_000_000", ["_" => ""]) so PHP converts it to 1,000,000 instead of 1

Full Changelog: v1.0.2...v1.0.3

Better support for PHP 7.0+ and GA4 Events

24 Aug 22:12
05fded5
Compare
Choose a tag to compare
  • Added PHP 7.1 to workflow testing
  • Added strict check on timestamp being within 3 days limitation (*Reference)
  • Added support for unlimited Events on the main Analytics class by sending events in batches of 25 (*Reference)
  • Updated Composer.json with package versions that support all supported PHP Versions
  • Updated PHPUnit Tests to fit the above changes and validate more requirements
  • Removed ?\Throwable type from GA4Exception, be vary of usage as it still requires a matching type

What's Changed

  • V1.x: Extend Testing & Update Found Issues by @AlexWestergaard in #10
  • Rework event limiter by chunking events on posting to Google Analytics by @AlexWestergaard in #12
  • Update Composer & CI Workflow by @AlexWestergaard in #13

Full Changelog: v1.0.1...v1.0.2

Update timestamp as microtime

25 Jul 12:37
8ce4cdb
Compare
Choose a tag to compare

Fixing the issue where microtime is not the proper format as 1*1000000 instead of 1*1000 and this resulted in events not being used as they are older than 3 days in microtime.

What's Changed

  • Update timestamp to microtime format by @AlexWestergaard in #8

Full Changelog: v1.0.0...v1.0.1

Version 1

21 Jul 01:18
dbf77c7
Compare
Choose a tag to compare

What's Changed

  • V1.x by @AlexWestergaard in #6

Full Changelog: v1.0.0-beta...v1.0.0