I am referring to this site https://developers.google.com/analytics/devguides/collection/ua/gtm/enhanced-ecommerce to send e-commerce data from the Google tag manager to the Google analytics dashboard.
Below is the GTM tag for the order-receipt page. While other checkout operations are kept in separate tags.
I am trying to send the purchase event through custom HTML in GTM Tag:
<script>
ga('create', 'UA-random-id-12', 'auto', {'name': 'PurchasePage'});
ga('PurchasePage.require', 'ec');
ga('PurchasePage.set', 'dimension1', 'c4f0cab13b5537uid32yiu334f0354c18');
ga('PurchasePage.ec:addProduct', {
'id': '12345',
'name': 'App1',
'price': '10.0000000000',
'variant': '7364284628',
'quantity': 1,
'coupon': '',
'brand': 'EYUIYEI',
'currency': 'USD'
});
ga('PurchasePage.set', 'dimension2', 'ALL');
ga('PurchasePage.set', 'dimension3', 'Marketplace');
ga('PurchasePage.set', 'dimension4', true);
ga('PurchasePage.ec:setAction', 'purchase', {
'id': '12345', 'revenue': '110.0000000000', 'tax': '0.0000000000', 'coupon': null, 'step': 4,
});
ga('PurchasePage.ec:setAction', 'checkout', {
'step': 4
});
ga('PurchasePage.send', 'pageview', {
'title': 'Order Receipt Page'
});
</script>
I can see the debug logs on the chrome console where the purchase event is being sent
_ _ _ _
| | | | | | (_)
__ _ ___ ___ __ _| | ___ __ _ _ __ __ _| |_ _| |_ _ ___ ___
/ _` |/ _ \ / _ \ / _` | |/ _ \ / _` | '_ \ / _` | | | | | __| |/ __/ __|
| (_| | (_) | (_) | (_| | | __/ | (_| | | | | (_| | | |_| | |_| | (__\__ \
\__, |\___/ \___/ \__, |_|\___| \__,_|_| |_|\__,_|_|\__, |\__|_|\___|___/
__/ | __/ | __/ |
|___/ |___/ |___/
react_devtools_backend.js:4026 Running analytics_debug.js. This script is intended for testing and debugging only.
...
VM1232 analytics.js:30 Running command: ga("PurchasePage.require", "ec")
VM1232 analytics.js:30 Waiting on require of "ec" to be fulfilled.
VM1232 analytics.js:30 Executing Google Analytics commands.
VM1232 analytics.js:30 Running command: ga("PurchasePage.require", "ec")
VM1232 analytics.js:30 Waiting on require of "ec" to be fulfilled.
VM1232 analytics.js:30 Executing Google Analytics commands.
VM1232 analytics.js:30 Registered new plugin: ga(provide, "ec", Function)
VM1232 analytics.js:30 Running command: ga("PurchasePage.require", "ec")
VM1232 analytics.js:30 Plugin "ec" intialized on tracker "PurchasePage".
VM1232 analytics.js:30 Running command: ga("PurchasePage.set", "dimension1", "c4f0cab13b5537uid32yiu334f0354c18")
VM1232 analytics.js:30 Running command: ga("PurchasePage.ec:addProduct", {id: "310647", name: "App1", price: "10.0000000000", variant: "7364284628", quantity: 1, coupon: "", brand: "EYUIYEI", currency: "USD"})
VM1232 analytics.js:30 Running command: ga("PurchasePage.set", "dimension2", "ALL")
VM1232 analytics.js:30 Running command: ga("PurchasePage.set", "dimension3", "MP")
VM1232 analytics.js:30 Running command: ga("PurchasePage.set", "dimension4", true)
VM1232 analytics.js:30 Running command: ga("PurchasePage.ec:setAction", "purchase", {id: "6332d33fe8d5156c6bb6b68b", revenue: "110.0000000000", tax: "0.0000000000", coupon: null, step: 4})
VM1232 analytics.js:30 Running command: ga("PurchasePage.ec:setAction", "checkout", {step: 4})
VM1232 analytics.js:30 Running command: ga("PurchasePage.send", "pageview", {title: "Order Receipt Page"})
react_devtools_backend.js:4026 Tag Assistant debug signal detected for unsupported legacy tag.
...
VM1232 analytics.js:30 Setting throttling cookie: "_gat_OrderReceiptPage"
VM1232 analytics.js:30
Sent beacon:
v=1&_v=j97d&a=2039992036&t=pageview&_s=1&dl=https%3A%2F%2Ftestqwerty.qaz.com%2Freceipt%2F001965%3ForderUuid%3D12345%26gtm_debug%3D123&dr=https%3A%2F%2Ftagassistant.google.com%2F&ul=en-gb&de=UTF-8&dt=Order%20Receipt%20Page&sd=30-bit&sr=1792x1120&vp=1792x373&je=0&_u=yCCAAUIJAAAAAC~&jid=1383585562&gjid=1942449811&cid=296136795.1634033045&tid=UA-randomid-8&_gid=376555535.1664271026&_r=1&cd1=c4f0cab13b5537uid32yiu334f0354c18&cd2=ALL&cd3=MP&cd4=1&cos=4&pa=checkout&pr1id=12345&pr1nm=App1&pr1pr=10.0000000000&pr1va=7364284628&pr1qt=1&pr1cc=&pr1br=EYUIYEI&z=136380644
VM1232 analytics.js:30 _j1 (&jid) 1383585562
VM1232 analytics.js:30 _j2 (&gjid) 1942449811
VM1232 analytics.js:30 adSenseId (&a) 2039992036
VM1232 analytics.js:30 apiVersion (&v) 1
VM1232 analytics.js:30 clientId (&cid) 296136795.1634033045
VM1232 analytics.js:30 dimension1 (&cd1) c4f0cab13b5537uid32yiu334f0354c18
VM1232 analytics.js:30 dimension2 (&cd2) ALL
VM1232 analytics.js:30 dimension3 (&cd3) MP
VM1232 analytics.js:30 dimension4 (&cd4) 1
VM1232 analytics.js:30 ec:action (&pa) checkout
VM1232 analytics.js:30 ec:product "1" brand (&pr1br) EYUIYEI
VM1232 analytics.js:30 ec:product "1" coupon (&pr1cc)
VM1232 analytics.js:30 ec:product "1" id (&pr1id) 310647
VM1232 analytics.js:30 ec:product "1" name (&pr1nm) App1
VM1232 analytics.js:30 ec:product "1" price (&pr1pr) 10.0000000000
VM1232 analytics.js:30 ec:product "1" quantity (&pr1qt) 1
VM1232 analytics.js:30 ec:product "1" variant (&pr1va) 7364284628
VM1232 analytics.js:30 ec:step (&cos) 4
VM1232 analytics.js:30 encoding (&de) UTF-8
VM1232 analytics.js:30 hitType (&t) pageview
VM1232 analytics.js:30 javaEnabled (&je) 0
VM1232 analytics.js:30 language (&ul) en-gb
VM1232 analytics.js:30 location (&dl) https://testqwerty.qaz.com/receipt/001965?orderUuid=12345>m_debug=123
VM1232 analytics.js:30 referrer (&dr) https://tagassistant.google.com/
VM1232 analytics.js:30 screenColors (&sd) 30-bit
VM1232 analytics.js:30 screenResolution (&sr) 1792x1120
VM1232 analytics.js:30 title (&dt) Order Receipt Page
VM1232 analytics.js:30 trackingId (&tid) UA-randomid-8
VM1232 analytics.js:30 viewportSize (&vp) 1792x373
But on GA dashboard, the unique events are showing as blank.
After removing the PurchasePage.ec:setAction', 'checkout' from the script, I was able to see unique events on the analytics dashboard.
<script>
ga('create', 'UA-random-id-12', 'auto', {'name': 'PurchasePage'});
ga('PurchasePage.require', 'ec');
ga('PurchasePage.set', 'dimension1', 'c4f0cab13b5537uid32yiu334f0354c18');
ga('PurchasePage.ec:addProduct', {
'id': '12345',
'name': 'App1',
'price': '10.0000000000',
'variant': '7364284628',
'quantity': 1,
'coupon': '',
'brand': 'EYUIYEI',
'currency': 'USD'
});
ga('PurchasePage.set', 'dimension2', 'ALL');
ga('PurchasePage.set', 'dimension3', 'Marketplace');
ga('PurchasePage.set', 'dimension4', true);
ga('PurchasePage.ec:setAction', 'purchase', {
'id': '12345', 'revenue': '110.0000000000', 'tax': '0.0000000000', 'coupon': null, 'step': 4,
});
ga('PurchasePage.send', 'pageview', {
'title': 'Order Receipt Page'
});
</script>
Related
I have an Axon Command which has an moneta Money object.
import lombok.Getter;
import lombok.ToString;
import lombok.experimental.SuperBuilder;
import org.javamoney.moneta.Money;
import java.time.LocalDate;
import java.util.UUID;
#Getter
#SuperBuilder
#ToString
public class MyAxonCommand {
private final UUID id;
private final Money hoogte;
private final LocalDate opleggingsdatum;
}
When i send this command with axon there is an exception.
commandGateway.sendAndWait(myAxonCommand.builder()
.id(new UUID(1, 1))
.hoogte(Money.of(0, "EUR"))
.opleggingsdatum(LocalDate.now())
.build());
The exception thrown is Caused by:
18:07:37.456 [main] INFO org.javamoney.moneta.DefaultMonetaryContextFactory - Using custom MathContext: precision=256, roundingMode=HALF_EVEN
18:07:37.465 [main] INFO nl.ind.handhaving.adapter.messaging.incoming.IndigoListener kvk:987654321 zn:Z1-31190106952 - INDiGO bericht ontvangen op methode: receiveMaatregelOpgelegd
18:07:37.928 [docker-java-stream--1691755530] INFO docker.axonserver - STDOUT: 2023-01-18 17:07:37.925 WARN 1 --- [nio-8024-exec-3] A.i.a.a.rest.DevelopmentRestController : [<anonymous>] Request to delete all events in context "default".
18:07:37.941 [EventProcessor[nl.ind.handhaving.application.query]-0] WARN org.axonframework.eventhandling.TrackingEventProcessor - Error occurred. Starting retry mode.
org.axonframework.axonserver.connector.AxonServerException: The Event Stream has been closed, so no further events can be retrieved
at org.axonframework.axonserver.connector.event.axon.EventBuffer.peekNullable(EventBuffer.java:178)
at org.axonframework.axonserver.connector.event.axon.EventBuffer.hasNextAvailable(EventBuffer.java:144)
at org.axonframework.eventhandling.TrackingEventProcessor.processBatch(TrackingEventProcessor.java:401)
at org.axonframework.eventhandling.TrackingEventProcessor.processingLoop(TrackingEventProcessor.java:300)
at org.axonframework.eventhandling.TrackingEventProcessor$TrackingSegmentWorker.run(TrackingEventProcessor.java:1072)
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.cleanUp(TrackingEventProcessor.java:1263)
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.run(TrackingEventProcessor.java:1240)
at java.base/java.lang.Thread.run(Thread.java:833)
18:07:37.942 [EventProcessor[nl.ind.handhaving.application.query]-0] WARN org.axonframework.eventhandling.TrackingEventProcessor - Releasing claim on token and preparing for retry in 1s
18:07:37.945 [EventProcessor[nl.ind.handhaving.application]-0] WARN org.axonframework.eventhandling.TrackingEventProcessor - Error occurred. Starting retry mode.
org.axonframework.axonserver.connector.AxonServerException: The Event Stream has been closed, so no further events can be retrieved
at org.axonframework.axonserver.connector.event.axon.EventBuffer.peekNullable(EventBuffer.java:178)
at org.axonframework.axonserver.connector.event.axon.EventBuffer.hasNextAvailable(EventBuffer.java:144)
at org.axonframework.eventhandling.TrackingEventProcessor.processBatch(TrackingEventProcessor.java:401)
at org.axonframework.eventhandling.TrackingEventProcessor.processingLoop(TrackingEventProcessor.java:300)
at org.axonframework.eventhandling.TrackingEventProcessor$TrackingSegmentWorker.run(TrackingEventProcessor.java:1072)
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.cleanUp(TrackingEventProcessor.java:1263)
at org.axonframework.eventhandling.TrackingEventProcessor$WorkerLauncher.run(TrackingEventProcessor.java:1240)
at java.base/java.lang.Thread.run(Thread.java:833)
18:07:37.945 [EventProcessor[nl.ind.handhaving.application]-0] WARN org.axonframework.eventhandling.TrackingEventProcessor - Releasing claim on token and preparing for retry in 1s
18:07:37.947 [EventProcessor[nl.ind.handhaving.application]-0] INFO org.axonframework.eventhandling.TrackingEventProcessor - Released claim
18:07:37.949 [EventProcessor[nl.ind.handhaving.application.query]-0] INFO org.axonframework.eventhandling.TrackingEventProcessor - Released claim
org.axonframework.commandhandling.CommandExecutionException: org.javamoney.moneta.spi.JDKCurrencyAdapter
at org.axonframework.axonserver.connector.ErrorCode.lambda$static$11(ErrorCode.java:88)
at org.axonframework.axonserver.connector.ErrorCode.convert(ErrorCode.java:182)
at org.axonframework.axonserver.connector.command.CommandSerializer.deserialize(CommandSerializer.java:164)
at org.axonframework.axonserver.connector.command.AxonServerCommandBus.lambda$doDispatch$1(AxonServerCommandBus.java:161)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at io.axoniq.axonserver.connector.command.impl.CommandChannelImpl$CommandResponseHandler.onNext(CommandChannelImpl.java:372)
at io.axoniq.axonserver.connector.command.impl.CommandChannelImpl$CommandResponseHandler.onNext(CommandChannelImpl.java:359)
at io.grpc.stub.ClientCalls$StreamObserverToCallListenerAdapter.onMessage(ClientCalls.java:466)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal(ClientCallImpl.java:661)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext(ClientCallImpl.java:646)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:133)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: AxonServerRemoteCommandHandlingException{message=An exception was thrown by the remote message handling component: org.javamoney.moneta.spi.JDKCurrencyAdapter, errorCode='AXONIQ-4002', server='134589#xxxxxxxxx}
at org.axonframework.axonserver.connector.ErrorCode.lambda$static$11(ErrorCode.java:86)
... 16 more}
The Axonserver logging - running in a docker :
2023-01-18T17:30:30.237808536Z _ ____
2023-01-18T17:30:30.237852159Z / \ __ _____ _ __ / ___| ___ _ ____ _____ _ __
2023-01-18T17:30:30.237857221Z / _ \ \ \/ / _ \| '_ \\___ \ / _ \ '__\ \ / / _ \ '__|
2023-01-18T17:30:30.237861155Z / ___ \ > < (_) | | | |___) | __/ | \ V / __/ |
2023-01-18T17:30:30.237864060Z /_/ \_\/_/\_\___/|_| |_|____/ \___|_| \_/ \___|_|
2023-01-18T17:30:30.237866979Z Standard Edition Powered by AxonIQ
2023-01-18T17:30:30.237869529Z
2023-01-18T17:30:30.237872060Z version: 4.5.16
2023-01-18T17:30:30.326181167Z 2023-01-18 17:30:30.321 INFO 1 --- [ main] io.axoniq.axonserver.AxonServer : Starting AxonServer using Java 11.0.14 on c32eb57825c4 with PID 1 (/app/classes started by root in /)
2023-01-18T17:30:30.331544104Z 2023-01-18 17:30:30.325 INFO 1 --- [ main] io.axoniq.axonserver.AxonServer : No active profile set, falling back to 1 default profile: "default"
2023-01-18T17:30:33.989108312Z 2023-01-18 17:30:33.988 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8024 (http)
2023-01-18T17:30:34.235755158Z 2023-01-18 17:30:34.231 INFO 1 --- [ main] A.i.a.a.c.MessagingPlatformConfiguration : Configuration initialized with SSL DISABLED and access control DISABLED.
2023-01-18T17:30:37.126812182Z 2023-01-18 17:30:37.125 INFO 1 --- [ main] io.axoniq.axonserver.AxonServer : Axon Server version 4.5.16
2023-01-18T17:30:39.285810090Z 2023-01-18 17:30:39.285 WARN 1 --- [ main] .s.s.UserDetailsServiceAutoConfiguration :
2023-01-18T17:30:39.285860293Z
2023-01-18T17:30:39.285865737Z Using generated security password: f23552a4-9623-4adb-831e-506eac6a10a9
2023-01-18T17:30:39.285868706Z
2023-01-18T17:30:39.285871675Z This generated password is for development use only. Your security configuration must be updated before running your application in production.
2023-01-18T17:30:39.285874618Z
2023-01-18T17:30:41.633817404Z 2023-01-18 17:30:41.633 INFO 1 --- [ main] io.axoniq.axonserver.grpc.Gateway : Axon Server Gateway started on port: 8124 - no SSL
2023-01-18T17:30:41.667366113Z 2023-01-18 17:30:41.667 INFO 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8024 (http) with context path ''
2023-01-18T17:30:42.561266508Z 2023-01-18 17:30:42.555 INFO 1 --- [ main] io.axoniq.axonserver.AxonServer : Started AxonServer in 12.861 seconds (JVM running for 13.412)
2023-01-18T17:30:57.342935513Z 2023-01-18 17:30:57.338 INFO 1 --- [grpc-executor-1] i.a.a.logging.TopologyEventsLogger : Application connected: handhaving-service, clientId = 149931#v2l1-xxxxl, clientStreamId = 149931#v2l1-xxxxx.87e0f589-66d8-41ee-ab4a-7bc599cc2c01, context = default
2023-01-18T17:31:02.213813565Z 2023-01-18 17:31:02.213 WARN 1 --- [nio-8024-exec-3] A.i.a.a.rest.DevelopmentRestController : [<anonymous>] Request to delete all events in context "default".
2023-01-18T17:31:04.567541554Z 2023-01-18 17:31:04.567 INFO 1 --- [grpc-executor-3] i.a.a.logging.TopologyEventsLogger : Application disconnected: handhaving-service, clientId = 149931#xxxxx.87e0f589-66d8-41ee-ab4a-7bc599cc2c01, context = default: Platform connection completed by client
The issue seems to be that Axon is storing this Money object in a database, according the errorCode='AXONIQ-4002'.
What can i do to fix this? Does Axon needs a hibernate UserType so Axon is able to store this Money object or some other kind of type converter?
It seems that the de-serilizer in the axon server has problems with the Money object.
In order to store this Money object in a view database - where i store the event generated by the command - i had to make a type conversion for hibernate. this seems to be related to the occurred exception.
The project uses:
Spring Boot 2.7.6
axon-spring-boot-starter 4.5.15
moneta 1.4.2
It al runs with Java Temurin 17.0.4
For axon we have no configuration for serializing so the default is used: XML
there are two existing IoT agents in our application, one is iotagent-ul(over HTTP), another is lwm2m-iotagent(over HTTP). Recently in order to integrate new sensors, I need to add a new iotagent-json(over MQTT). After bringing up the system, there is some strange error log as I pasted at the end:
(1) iotagent-ul is over HTTP, IOTA_DEFAULT_TRANSPORT is not defined in iotagent-ul, just use the default value HTTP, but iotagent-ul always complains that "Couldn't connect with MQTT broker" and "Error: Callback was already called", why will iotagent-ul try to connect MQTT broker?
(2) iotagent-json is defined with IOTA_DEFAULT_TRANSPORT=MQTT, but it also reports a error for IOTAJSON.AMQP.Binding, should I just ignore it?
These containers can run up, but an endless error log is thrown out in the console. BTW, before adding the new iotagent-json, these two previous iotagent-ul and lwm2m-iotagent can work properly.
Could you help me view the error info and the IoT agents definition in yml? Any comments are appreciated, thank you very much.
1 The services defined in docker-compose.yml file:
# IoT Agents ##################################################################
iot-agent-ul:
image: fiware/iotagent-ul
hostname: iot-agent-ul
container_name: fiware-iot-agent-ul
depends_on:
- mongo-db
networks:
- default
expose:
- "4041"
- "7896"
ports:
- "4041:4041"
- "7896:7896"
environment:
- "IOTA_CB_HOST=orion" # name of the context broker to update context
- "IOTA_CB_PORT=1026" # port the context broker listens on to update context
- "IOTA_CB_NGSI_VERSION=v2" # NGSI version to use
- "IOTA_NORTH_PORT=4041" # port for devices provisioning
- "IOTA_REGISTRY_TYPE=mongodb" #Whether to hold IoT device info in memory or in a database
- "IOTA_LOG_LEVEL=ERROR" #The log level of the IoT Agent
- "IOTA_TIMESTAMP=true" # whether to include or not the timestamp
- "IOTA_MONGO_HOST=mongo-db" # The host name of MongoDB
- "IOTA_MONGO_PORT=27017" # The port mongoDB is listening on
- "IOTA_MONGO_DB=iotagentul" # The name of the database used in mongoDB
- "IOTA_HTTP_PORT=7896" # The port used for device traffic over HTTP
- "IOTA_PROVIDER_URL=http://iot-agent-ul:4041" # URL of the agent
- "IOTA_AUTOCAST=true" # autocasting of values into NGSI standard
iot-agent-lwm2m:
image: hopu/lwm2m-iotagent:observe-and-read
hostname: iot-agent-lwm2m
container_name: fiware-iot-agent-lwm2m
expose:
- "4042"
- "5683"
ports:
- "4042:4042"
- "5683:5683/udp"
environment:
- "IOTA_CB_HOST=orion" # name of the context broker to update context
- "IOTA_CB_PORT=1026" # port the context broker listens on to update context
- "IOTA_NORTH_PORT=4042" # port for devices provisioning
- "IOTA_REGISTRY_TYPE=mongodb" # whether to hold IoT device info in memory or in a database
- "IOTA_LOG_LEVEL=ERROR" #The log level of the IoT Agent
- "IOTA_TIMESTAMP=true" # whether to include or not the timestamp
- "IOTA_MONGO_HOST=mongo-db" # The host name of MongoDB
- "IOTA_MONGO_PORT=27017" # The port mongoDB is listening on
- "IOTA_MONGO_DB=iotagentlwm2m" # The name of the database used in mongoDB
- "IOTA_HTTP_PORT=5683" # The port used for device traffic over HTTP
- "IOTA_PROVIDER_URL=http://iot-agent-lwm2m:4042" # URL of the agent
- "IOTA_AUTOCAST=true" # autocasting of values into NGSI standard
volumes:
- "./iota-lwm2m/config.js:/opt/iota-lwm2m/config.js"
- "./iota-lwm2m/omaRegistry.json:/opt/iota-lwm2m/omaRegistry.json"
- "./iota-lwm2m/omaInverseRegistry.json:/opt/iota-lwm2m/omaInverseRegistry.json"
restart: on-failure
depends_on:
- mongo-db
- orion
networks:
- default
iot-agent-json:
image: fiware/iotagent-json:latest
hostname: iot-agent-json
container_name: fiware-iot-agent-json
depends_on:
- mongo-db
- mosquitto
expose:
- "4043"
- "7896" # No traffic,7896 is the http listening port for sensors
ports:
- "4043:4043"
- "7898:7898" # No traffic
environment:
- "IOTA_CB_HOST=orion" # name of the context broker to update context
- "IOTA_CB_PORT=1026" # port the context broker listens on to update context
- "IOTA_NORTH_PORT=4043" # port for devices provisioning
- "IOTA_REGISTRY_TYPE=mongodb" # Whether to hold IoT device info in memory or in a database
- "IOTA_LOG_LEVEL=DEBUG" # The log level of the IoT Agent
- "IOTA_TIMESTAMP=true" # whether to include or not the timestamp
- "IOTA_CB_NGSI_VERSION=v2" # NGSI version to use
- "IOTA_AUTOCAST=true" # autocasting of values into NGSI standard
- "IOTA_MONGO_HOST=mongo-db" # The host name of MongoDB
- "IOTA_MONGO_PORT=27017" # The port mongoDB is listening on
- "IOTA_MONGO_DB=iotagentjson" # The name of the database used in mongoDB
- "IOTA_HTTP_PORT=7898" # The port used for device traffic over HTTP
- "IOTA_PROVIDER_URL=http://iot-agent:4043" # URL of the agent
- "IOTA_DEFAULT_RESOURCE=/iot/json" # IOTA_PROVIDER_URL, the default path the IoT Agent uses listening for JSON measures over HTTP.
- "IOTA_MQTT_HOST=mosquitto" # MQTT broker service
- "IOTA_MQTT_PORT=1883" # MQTT service port
- "IOTA_DEFAULT_TRANSPORT=MQTT" # ---
- "IOTA_MQTT_USERNAME=myusername"
- "IOTA_MQTT_PASSWORD=mypassword"
networks:
- default
2 After docker containers start-up, some error log printed out:
fiware-iot-agent-ul | time=2022-08-23T09:19:32.404Z | lvl=ERROR | corr=650cc5a7-e0b0-406a-bb7d-84db422bb0e3 | trans=650cc5a7-e0b0-406a-bb7d-84db422bb0e3 | op=IOTAUL.AMQP.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=connect ECONNREFUSED 127.0.0.1:5672 | comp=IoTAgent
fiware-iot-agent-ul | time=2022-08-23T09:19:32.405Z | lvl=FATAL | corr=650cc5a7-e0b0-406a-bb7d-84db422bb0e3 | trans=650cc5a7-e0b0-406a-bb7d-84db422bb0e3 | op=IoTAgentNGSI.ContextServer | from=n/a | srv=n/a | subsrv=n/a | msg=GLOBAL-002: Couldn't connect with MQTT broker: {"errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":1883} | comp=IoTAgent
fiware-iot-agent-ul | time=2022-08-23T09:19:32.409Z | lvl=ERROR | corr=n/a | trans=n/a | op=IoTAgentNGSI.DomainControl | from=n/a | srv=n/a | subsrv=n/a | msg=Error: Callback was already called.
fiware-iot-agent-ul | at /opt/iotaul/node_modules/async/dist/async.js:969:32
fiware-iot-agent-ul | at MqttClient.<anonymous> (/opt/iotaul/lib/bindings/MQTTBinding.js:375:17)
fiware-iot-agent-ul | at MqttClient.emit (node:events:539:35)
fiware-iot-agent-ul | at MqttClient.emit (node:domain:475:12)
fiware-iot-agent-ul | at Socket.streamErrorHandler (/opt/iotaul/node_modules/mqtt/lib/client.js:460:12)
fiware-iot-agent-ul | at Socket.emit (node:events:527:28)
fiware-iot-agent-ul | at Socket.emit (node:domain:475:12)
fiware-iot-agent-ul | at emitErrorNT (node:internal/streams/destroy:157:8)
fiware-iot-agent-ul | at emitErrorCloseNT (node:internal/streams/destroy:122:3)
fiware-iot-agent-ul | at processTicksAndRejections (node:internal/process/task_queues:83:21) {
fiware-iot-agent-ul | domainThrown: true
fiware-iot-agent-ul | } | comp=IoTAgent
fiware-iot-agent-ul | time=2022-08-23T09:19:33.425Z | lvl=FATAL | corr=n/a | trans=n/a | op=n/a | from=n/a | srv=n/a | subsrv=n/a | msg=GLOBAL-002: Couldn't connect with MQTT broker: {"errno":-111,"code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":1883} | comp=IoTAgent
fiware-iot-agent-ul | time=2022-08-23T09:19:33.426Z | lvl=FATAL | corr=n/a | trans=n/a | op=IoTAgentNGSI.Global | from=n/a | srv=n/a | subsrv=n/a | msg=An unexpected exception has been raised. Ignoring: Error: Callback was already called.
fiware-iot-agent-ul | at /opt/iotaul/node_modules/async/dist/async.js:969:32
fiware-iot-agent-ul | at MqttClient.<anonymous> (/opt/iotaul/lib/bindings/MQTTBinding.js:375:17)
fiware-iot-agent-ul | at MqttClient.emit (node:events:539:35)
fiware-iot-agent-ul | at MqttClient.emit (node:domain:475:12)
fiware-iot-agent-ul | at Socket.streamErrorHandler (/opt/iotaul/node_modules/mqtt/lib/client.js:460:12)
fiware-iot-agent-ul | at Socket.emit (node:events:527:28)
fiware-iot-agent-ul | at Socket.emit (node:domain:475:12)
fiware-iot-agent-ul | at emitErrorNT (node:internal/streams/destroy:157:8)
fiware-iot-agent-ul | at emitErrorCloseNT (node:internal/streams/destroy:122:3)
fiware-iot-agent-ul | at processTicksAndRejections (node:internal/process/task_queues:83:21) | comp=IoTAgent
fiware-iot-agent-json | time=2022-08-23T09:19:35.473Z | lvl=INFO | corr=76c65807-e6f8-4ed0-ab3c-ead581e9d6bd | trans=76c65807-e6f8-4ed0-ab3c-ead581e9d6bd | op=IOTAJSON.MQTT.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=connected | comp=IoTAgent
fiware-iot-agent-json | time=2022-08-23T09:19:35.486Z | lvl=ERROR | corr=76c65807-e6f8-4ed0-ab3c-ead581e9d6bd | trans=76c65807-e6f8-4ed0-ab3c-ead581e9d6bd | op=IOTAJSON.AMQP.Binding | from=n/a | srv=n/a | subsrv=n/a | msg=connect ECONNREFUSED 127.0.0.1:5672 | comp=IoTAgent
Using the nios lookup modules, I can get a list of dicts of records
- set_fact:
records: "{{ lookup('community.general.nios', 'record:a', filter={'name~': 'abc.com'}) }}"
This returns something like
- ref: record:a/someBase64:name/view
name: abc.com
ipv4addr: 1.2.3.4
view: default
- ref: record:a/someBase64:name/view
name: def.abc.com
ipv4addr: 1.2.3.5
view: default
- ref: record:a/someBase64:name/view
name: ghi.abc.com
ipv4addr: 1.2.3.6
view: default
I want to convert this into a dict of dicts of {name}: a: {ipv4addr}
abc.com:
a: 1.2.3.4
def.abc.com:
a: 1.2.3.5
ghi.abc.com:
a: 1.2.3.6
So that I can then run a similar lookup to get other record types (e.g. cname) and combine them into the same dict. The items2dict filter seems halfway there, but I want the added a: key underneath.
If you just wanted a dictionary that maps name to an ipv4 address, like:
{
"abc.com": "1.2.3.4",
...
}
You could use a simple json_query expression. Take a look at the
set_fact task in the following example:
- hosts: localhost
gather_facts: false
vars:
data:
- ref: record:a/someBase64:name/view
name: abc.com
ipv4addr: 1.2.3.4
view: default
- ref: record:a/someBase64:name/view
name: def.abc.com
ipv4addr: 1.2.3.5
view: default
- ref: record:a/someBase64:name/view
name: ghi.abc.com
ipv4addr: 1.2.3.6
view: default
tasks:
- set_fact:
name_map: "{{ dict(data|json_query('[].[name, ipv4addr]')) }}"
- debug:
var: name_map
Running that playbook will output:
PLAY [localhost] ***************************************************************
TASK [set_fact] ****************************************************************
ok: [localhost]
TASK [debug] *******************************************************************
ok: [localhost] => {
"name_map": {
"abc.com": "1.2.3.4",
"def.abc.com": "1.2.3.5",
"ghi.abc.com": "1.2.3.6"
}
}
PLAY RECAP *********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
You could use a similar structure to extract other data (e.g. cname records). This would get you dictionary per type of data, rather than merging everything together in a single dictionary as you've requested, but this might end up being easier to work with.
To get exactly the structure you want, you can use set_fact in a loop, like this:
- hosts: localhost
vars:
data:
- ref: record:a/someBase64:name/view
name: abc.com
ipv4addr: 1.2.3.4
view: default
- ref: record:a/someBase64:name/view
name: def.abc.com
ipv4addr: 1.2.3.5
view: default
- ref: record:a/someBase64:name/view
name: ghi.abc.com
ipv4addr: 1.2.3.6
view: default
gather_facts: false
tasks:
- set_fact:
name_map: "{{ name_map|combine({item.name: {'a': item.ipv4addr}}) }}"
loop: "{{ data }}"
vars:
name_map: {}
- debug:
var: name_map
This will produce:
PLAY [localhost] ***************************************************************
TASK [set_fact] ****************************************************************
ok: [localhost] => (item={'ref': 'record:a/someBase64:name/view', 'name': 'abc.com', 'ipv4addr': '1.2.3.4', 'view': 'default'})
ok: [localhost] => (item={'ref': 'record:a/someBase64:name/view', 'name': 'def.abc.com', 'ipv4addr': '1.2.3.5', 'view': 'default'})
ok: [localhost] => (item={'ref': 'record:a/someBase64:name/view', 'name': 'ghi.abc.com', 'ipv4addr': '1.2.3.6', 'view': 'default'})
TASK [debug] *******************************************************************
ok: [localhost] => {
"name_map": {
"abc.com": {
"a": "1.2.3.4"
},
"def.abc.com": {
"a": "1.2.3.5"
},
"ghi.abc.com": {
"a": "1.2.3.6"
}
}
}
PLAY RECAP *********************************************************************
localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
I integrated Google Analytics through GTM and now I´m trying to enable e-commerce tracking. However, for some reason is not working.
*sorry due to Company privacy I changed the URL
Here is the debug code
Initializing Google Analytics.
analytics_debug.js:24 Loading resource for plugin: ecommerce
analytics_debug.js:24 Loading script: "https://www.google-analytics.com/plugins/ua/ecommerce.js"
analytics_debug.js:24 Running command: ga("create", "UA-100134152-1", {name: "gtm1", cookieDomain: "auto"})
analytics_debug.js:24 Creating new tracker: gtm1
analytics_debug.js:24 Auto cookieDomain found: "bu.com"
analytics_debug.js:24 Running command: ga("gtm1.set", ">m", "2wg3b2TCH6J4M")
analytics_debug.js:24 Running command: ga("gtm1.set", "hitCallback", [function])
analytics_debug.js:24 Running command: ga("gtm1.require", "ecommerce", "//www.google-analytics.com/plugins/ua/ecommerce.js")
analytics_debug.js:24 Waiting on require of "ecommerce" to be fulfilled.
analytics_debug.js:24 Registered new plugin: ga(provide, "render", Function)
analytics_debug.js:24 Running command: ga("gtm1.require", "ecommerce", "//www.google-analytics.com/plugins/ua/ecommerce.js")
analytics_debug.js:24 Waiting on require of "ecommerce" to be fulfilled.
analytics_debug.js:24 Executing Google Analytics commands.
analytics_debug.js:24 Registered new plugin: ga(provide, "ecommerce", Function)
analytics_debug.js:24 Running command: ga("gtm1.require", "ecommerce", "//www.google-analytics.com/plugins/ua/ecommerce.js")
analytics_debug.js:24 Plugin "ecommerce" intialized on tracker "gtm1".
analytics_debug.js:24 Running command: ga("gtm1.ecommerce:addTransaction", {id: undefined, affiliation: undefined, revenue: undefined, shipping: undefined, tax: undefined})
analytics_debug.js:24 Running command: ga("gtm1.ecommerce:send")
analytics_debug.js:24 Running command: ga("create", "UA-100134152-1", {name: "gtm2", cookieDomain: "auto"})
analytics_debug.js:24 Running command: ga("gtm2.set", ">m", "2wg3b2TCH6J4M")
analytics_debug.js:24 Running command: ga("gtm2.set", "hitCallback", [function])
analytics_debug.js:24 Running command: ga("gtm2.send", "pageview")
analytics_debug.js:24
analytics_debug.js:24 <unknown> (>m) 2wg3b2TCH6J4M
analytics_debug.js:24 _j1 (&jid)
analytics_debug.js:24 _j2 (&gjid)
analytics_debug.js:24 adSenseId (&a) 1515998799
analytics_debug.js:24 apiVersion (&v) 1
analytics_debug.js:24 clientId (&cid) 1152172694.1552546478
analytics_debug.js:24 encoding (&de) UTF-8
analytics_debug.js:24 hitType (&t) pageview
analytics_debug.js:24 javaEnabled (&je) 0
analytics_debug.js:24 language (&ul) en-us
analytics_debug.js:24 location (&dl) https://www.bu.com/thank-you
analytics_debug.js:24 screenColors (&sd) 24-bit
analytics_debug.js:24 screenResolution (&sr) 1920x1080
analytics_debug.js:24 title (&dt) Thank You | Bu
analytics_debug.js:24 trackingId (&tid) UA-100134152-1
analytics_debug.js:24 viewportSize (&vp) 1903x215
iframe.e378e2e8.chunk.js:1 The AudioContext was not allowed to start. It must be resumed (or created) after a user gesture on the page.
dataLayer
1. ecommerce:
1. purchase:
1. actionField: {id: 35308, affiliation: null, revenue: 78, tax: 3.9}
2. products: Array(1)
1. 0: {name: "Buziness Vulnerability Scanning Assessment (ecomtesting.com)", id: 1506425543, brand: "Bu", category: "Bu Product", quantity: 1, …}
2. length: 1
3. __proto__: Array(0)
Its seems the Datalayes is firing, but no datas passing to Console or GA.
Please help
Since we added GA events to our webapp we lost bounce rate in our signup page. I found that adding "nonInteraction" key should make the trick but since I added it bounce rate is still 0.
Here it is what Analytic Debugger Add On, tell us what we are sending:
Download the React DevTools for a better development experience: http://fb.me/react-devtools
Download the React DevTools for a better development experience: http://fb.me/react-devtools
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/.
Initializing Google Analytics.
Running command: ga("create", "UA-45345323-1", "app.wizeline.com", {siteSpeedSampleRate: 100})
Creating new tracker: t0
Running command: ga("set", "forceSSL", true)
Running command: ga("send", "pageview", {page: "#/signup", title: "signup", nonInteraction: 1})
Setting throttling cookie: "_gat"
Sent beacon:
v=1&_v=j36d&a=1180036341&t=pageview&ni=1&_s=1&dl=https%3A%2F%2Fapp.wizeline.com%2F&dp=%23%2Fsignup&ul=en-us&de=UTF-8&dt=signup&sd=24-bit&sr=1920x1080&vp=1920x502&je=1&fl=17.0%20r0&_u=QAEAAQABI~&jid=552286626&cid=1169363107.1416505139&tid=UA-45345323-1&_r=1&z=1165069347
_j1 (&jid) 552286626
adSenseId (&a) 1180036341
apiVersion (&v) 1
clientId (&cid) 1169363107.1416505139
encoding (&de) UTF-8
flashVersion (&fl) 17.0 r0
hitType (&t) pageview
javaEnabled (&je) 1
language (&ul) en-us
location (&dl) https://app.wizeline.com/
nonInteraction (&ni) 1
page (&dp) #/signup
screenColors (&sd) 24-bit
screenResolution (&sr) 1920x1080
title (&dt) signup
trackingId (&tid) UA-45345323-1
viewportSize (&vp) 1920x502
Running command: ga("send", "event", "signup", "view", "form_viewed", {nonInteraction: 1}, undefined)
Sent beacon:
v=1&_v=j36d&a=1180036341&t=event&ni=1&_s=2&dl=https%3A%2F%2Fapp.wizeline.com%2F&ul=en-us&de=UTF-8&dt=Wizeline&sd=24-bit&sr=1920x1080&vp=1920x502&je=1&fl=17.0%20r0&ec=signup&ea=view&el=form_viewed&_u=QAEAAQABI~&jid=&cid=1169363107.1416505139&tid=UA-45345323-1&z=2130626078
_j1 (&jid)
adSenseId (&a) 1180036341
apiVersion (&v) 1
clientId (&cid) 1169363107.1416505139
encoding (&de) UTF-8
eventAction (&ea) view
eventCategory (&ec) signup
eventLabel (&el) form_viewed
flashVersion (&fl) 17.0 r0
hitType (&t) event
javaEnabled (&je) 1
language (&ul) en-us
location (&dl) https://app.wizeline.com/
nonInteraction (&ni) 1
screenColors (&sd) 24-bit
screenResolution (&sr) 1920x1080
title (&dt) Wizeline
trackingId (&tid) UA-45345323-1
viewportSize (&vp) 1920x502
Sent beacon:
v=1&_v=j36d&a=1180036341&t=timing&_s=3&dl=https%3A%2F%2Fapp.wizeline.com%2F&ul=en-us&de=UTF-8&dt=Wizeline&sd=24-bit&sr=1920x1080&vp=1920x502&je=1&fl=17.0%20r0&plt=6854&pdt=2&dns=0&rrt=508&srt=217&tcp=40&dit=5126&clt=5126&_u=QAEAAQABI~&jid=&cid=1169363107.1416505139&tid=UA-45345323-1&z=1698011418
_j1 (&jid)
adSenseId (&a) 1180036341
apiVersion (&v) 1
clientId (&cid) 1169363107.1416505139
encoding (&de) UTF-8
flashVersion (&fl) 17.0 r0
hitType (&t) timing
javaEnabled (&je) 1
l1 (&plt) 6854
l2 (&pdt) 2
l3 (&dns) 0
l4 (&rrt) 508
l5 (&srt) 217
l6 (&tcp) 40
l7 (&dit) 5126
l8 (&clt) 5126
language (&ul) en-us
location (&dl) https://app.wizeline.com/
screenColors (&sd) 24-bit
screenResolution (&sr) 1920x1080
title (&dt) Wizeline
trackingId (&tid) UA-45345323-1
viewportSize (&vp) 1920x502
Inspectlet: fatal error: wid has not been set.
It shows both "nonInteraction" keys but again it does not let our bounce rate to increase from 0.
Any idea/misreading/wrong syntax I'm doing?
Thanks!