-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Moved configuring to service provider. #1
base: main
Are you sure you want to change the base?
Conversation
if (config('google-analytics-4-measurement-protocol.measurement_id') === null | ||
|| config('google-analytics-4-measurement-protocol.api_secret') === null | ||
) { | ||
throw new Exception('Please set .env variables for Google Analytics 4 Measurement Protocol as per the readme file first.'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that someone will face this exception for any request just after installing the package until they set the .env vars?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This called only on resolving 'ga4'. Same as in the constructor.
function () { | ||
$clientId = session(config('google-analytics-4-measurement-protocol.client_id_session_key')); | ||
if (empty($clientId)) { | ||
throw new Exception('Please use the package provided blade directive or set client_id manually before posting an event.'); | ||
} | ||
|
||
return $clientId; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the benefit of passing the closure from here instead of keeping the login inside the facade?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Service class should not know about configuration. But provider must configuring service.
Thanks for the PR Dmytro.
Maybe we can have a separate PR for this to keep things simple? |
Reverted "Also need to send additional user parameters with events like user_id." Simplified using only clientId for allow Closure for dynamic resolver for clientId |
A bit occupied these days. Will revert after 17th May, thanks. |
@dkulyk I haven't added any tests in the package yet. Reason - I wasn't sure how to. Do you have any ideas? |
GA4MeasurementProtocol required configuration for using. This is a problem for using it manually without package configuring.
Also need to send additional user parameters with events like user_id.