snowplow / snowplow-php-tracker

Snowplow event tracker for PHP. Add analytics into your PHP apps and scripts
http://snowplowanalytics.com
34 stars 36 forks source link

Add a setter for session ID on a subject #98

Closed TijmenWierenga closed 2 years ago

TijmenWierenga commented 2 years ago

The Snowplow Tracker Protocol allows a unique identifier (UUID) for a session (sid). The current version of the PHP Tracker does not support adding a session ID to a subject. This pull request adds this feature.

Usage:

$subject = new \Snowplow\Tracker\Subject;

$subject->setSessionId('759e1c9a-6b74-403c-8b6f-18eb9f0c2f02');
snowplowcla commented 2 years ago

Thanks for your pull request. Is this your first contribution to a Snowplow open source project? Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://docs.snowplowanalytics.com/docs/contributing/contributor-license-agreement/ to learn more and sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.

TijmenWierenga commented 2 years ago

I signed it!

snowplowcla commented 2 years ago

Confirmed! @TijmenWierenga has signed the Contributor License Agreement. Thanks so much.

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.07%) to 89.013% when pulling c164a487d1b571e23e7ebbc210dfac1ac4eb4080 on tweakers:add-session-id into 530ba8f8d76ade19cb6ce4cbd996df6c2fbc62b6 on snowplow:master.

paulboocock commented 2 years ago

Thanks for the PR, looks good! We can wrap it into a 0.5.0 release shortly.

If you have the chance, I notice we're also missing vid from the Subject too. Given how closely sid and vid are, it would make sense to add that too. setSessionIndex perhaps makes sense.

vid | domain_sessionidx | Index of number of visits that this user_id has made to this domain e.g. 1 is first visit

TijmenWierenga commented 2 years ago

I added the vid too by adding the following setter:

$subject->setSessionIndex(1);