Skip to content

Feature - add analytics#44

Open
edge-marge wants to merge 8 commits intomainfrom
feature/analytics
Open

Feature - add analytics#44
edge-marge wants to merge 8 commits intomainfrom
feature/analytics

Conversation

@edge-marge
Copy link
Copy Markdown
Contributor

do not merge - missing distinct_id

@orcist
Copy link
Copy Markdown
Collaborator

orcist commented Mar 23, 2026

@edge-marge wouldn't this implementation create a new instance of AnalyticsApi every time you access the property? Maybe it would be better to declare it once as a property and reuse it after?

private AnalyticsApi Analytics = new AnalyticsApi(getDistinctId());

also, it seems this implementation has hardcoded the UTM source, could you instead get the value dynamically from EdgegapWindowMetadata.DEFAULT_UTM_SOURCE_TAG?

@orcist orcist changed the title add analytics Feature - add analytics Apr 7, 2026
Copy link
Copy Markdown
Collaborator

@orcist orcist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in addition to the comments above, could you also modify the events for Rebuild from Source feature so that the different stages are not stored in a new property rebuild_step but instead you concatenate that into the button name?

e.g. 5. Upload to Edgegap > Rebuild from Source > Containerize

this will make it much much easier to build analysis compared to storing two different properties.

{
properties.Add("rebuild_step", "Build");
}
if (_organizationInfo is not null)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when would this ever be null? I thought we collapse and disable all the sections if you don't have a valid API token...

Comment on lines +1338 to +1351
AnalyticsApi analyticsApi = getAnalyticsApi();

if (!string.IsNullOrEmpty(await ValidateDockerRequirement(false)))
{
if (_organizationInfo is not null)
{
Dictionary<string, string> properties = new Dictionary<string, string>()
{
{ "identifier", _organizationInfo.Identifier },
{ "provider", _organizationInfo.Provider },
{ "button_name", buttonName },
{ "utm_source", EdgegapWindowMetadata.DEFAULT_UTM_SOURCE_TAG },
{ "succeeded", false.ToString() },
{ "error_message", "Docker validation failed" },
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be useful to add the validation error to the error message for clarity like this. needs to be tested though before merging.

Suggested change
AnalyticsApi analyticsApi = getAnalyticsApi();
if (!string.IsNullOrEmpty(await ValidateDockerRequirement(false)))
{
if (_organizationInfo is not null)
{
Dictionary<string, string> properties = new Dictionary<string, string>()
{
{ "identifier", _organizationInfo.Identifier },
{ "provider", _organizationInfo.Provider },
{ "button_name", buttonName },
{ "utm_source", EdgegapWindowMetadata.DEFAULT_UTM_SOURCE_TAG },
{ "succeeded", false.ToString() },
{ "error_message", "Docker validation failed" },
string error = await ValidateDockerRequirement(false);
if (!string.IsNullOrEmpty(error))
{
if (_organizationInfo is not null)
{
Dictionary<string, string> properties = new Dictionary<string, string>()
{
{ "identifier", _organizationInfo.Identifier },
{ "provider", _organizationInfo.Provider },
{ "button_name", buttonName },
{ "utm_source", EdgegapWindowMetadata.DEFAULT_UTM_SOURCE_TAG },
{ "succeeded", false.ToString() },
{ "error_message", $"Docker validation failed. {error}" },

};
if (_organizationInfo is not null)
{
properties.Add("identifier", _organizationInfo.Identifier);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like a duplicate, you're setting the identifier in the block above.

};
if (_organizationInfo is not null)
{
properties.Add("identifier", _organizationInfo.Identifier);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like duplicate identifier

};
if (_organizationInfo is not null)
{
properties.Add("identifier", _organizationInfo.Identifier);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicate identifier also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants