Skip to content

Commit

Permalink
initial work for goog analytics #657
Browse files Browse the repository at this point in the history
  • Loading branch information
syjer committed Jun 19, 2019
1 parent 8c5164c commit 2d5ea61
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public class EventWithAdditionalInfo implements DateValidity {
private final PromotionsConfiguration promotionsConfiguration;
//

private final AnalyticsConfiguration analyticsConfiguration;

public String getShortName() {
return event.getShortName();
}
Expand Down Expand Up @@ -186,6 +188,10 @@ public PromotionsConfiguration getPromotionsConfiguration() {
return promotionsConfiguration;
}

public AnalyticsConfiguration getAnalyticsConfiguration() {
return analyticsConfiguration;
}

@AllArgsConstructor
@Getter
public static class PaymentProxyWithParameters {
Expand Down Expand Up @@ -227,4 +233,11 @@ public static class PromotionsConfiguration {
private final boolean hasAccessPromotions;
private final boolean usePartnerCode;
}

@AllArgsConstructor
@Getter
public static class AnalyticsConfiguration {
private final String googleAnalyticsKey;
private final boolean googleAnalyticsScrambledInfo; //<- see GOOGLE_ANALYTICS_ANONYMOUS_MODE
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ public ResponseEntity<EventWithAdditionalInfo> getEvent(@PathVariable("eventName
ENABLE_ATTENDEE_AUTOCOMPLETE,
ENABLE_TICKET_TRANSFER,
DISPLAY_DISCOUNT_CODE_BOX,
USE_PARTNER_CODE_INSTEAD_OF_PROMOTIONAL
USE_PARTNER_CODE_INSTEAD_OF_PROMOTIONAL,
GOOGLE_ANALYTICS_KEY,
GOOGLE_ANALYTICS_ANONYMOUS_MODE
));

var geoInfoConfiguration = Map.of(
Expand Down Expand Up @@ -177,9 +179,6 @@ public ResponseEntity<EventWithAdditionalInfo> getEvent(@PathVariable("eventName
var formattedEndDate = Formatters.getFormattedDate(event, event.getEnd(), "common.event.date-format", messageSource);
var formattedEndTime = Formatters.getFormattedDate(event, event.getEnd(), "common.event.time-format", messageSource);


var partialConfig = Configuration.from(event);

//invoicing information
boolean canGenerateReceiptOrInvoiceToCustomer = configurationManager.canGenerateReceiptOrInvoiceToCustomer(event);
boolean euVatCheckingEnabled = vatChecker.isReverseChargeEnabledFor(event.getOrganizationId());
Expand Down Expand Up @@ -210,10 +209,17 @@ public ResponseEntity<EventWithAdditionalInfo> getEvent(@PathVariable("eventName
var promoConf = new EventWithAdditionalInfo.PromotionsConfiguration(hasAccessPromotions, usePartnerCode);
//

//analytics configuration
var googAnalyticsKey = configurationsValues.get(GOOGLE_ANALYTICS_KEY).getValueOrDefault(null);
var googAnalyticsScrambled = configurationsValues.get(GOOGLE_ANALYTICS_ANONYMOUS_MODE).getValueAsBooleanOrDefault(true);
var analyticsConf = new EventWithAdditionalInfo.AnalyticsConfiguration(googAnalyticsKey, googAnalyticsScrambled);
//

return new ResponseEntity<>(new EventWithAdditionalInfo(event, ld.getMapUrl(), organization, descriptions, availablePaymentMethods,
bankAccount, bankAccountOwner,
formattedBeginDate, formattedBeginTime,
formattedEndDate, formattedEndTime, invoicingConf, captchaConf, assignmentConf, promoConf), getCorsHeaders(), HttpStatus.OK);
formattedEndDate, formattedEndTime,
invoicingConf, captchaConf, assignmentConf, promoConf, analyticsConf), getCorsHeaders(), HttpStatus.OK);
})
.orElseGet(() -> ResponseEntity.notFound().headers(getCorsHeaders()).build());
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/alfio/util/TemplateResource.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@


public enum TemplateResource {
GOOGLE_ANALYTICS("/alfio/templates/google-analytics.ms", false, "text/plain", TemplateManager.TemplateOutput.TEXT),

@Deprecated
GOOGLE_ANALYTICS("", false, "", TemplateManager.TemplateOutput.TEXT),

CONFIRMATION_EMAIL_FOR_ORGANIZER("/alfio/templates/confirmation-email-for-organizer-txt.ms", true, "text/plain", TemplateManager.TemplateOutput.TEXT) {
@Override
Expand Down
9 changes: 0 additions & 9 deletions src/main/resources/alfio/templates/google-analytics.ms

This file was deleted.

0 comments on commit 2d5ea61

Please sign in to comment.