File tree Expand file tree Collapse file tree
tests/Application/config/packages Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,8 +5,3 @@ sylius_ui:
55 user_com_configuration :
66 template : ' @BitBagSyliusUserComPlugin/UserApiResource/_userComCredentials.html.twig'
77 priority : 25
8- sylius.shop.layout.stylesheets :
9- blocks :
10- user_com :
11- template : ' @BitBagSyliusUserComPlugin/_userComScripts.html.twig'
12- priority : 25
Original file line number Diff line number Diff line change 55556. Take advantage of channel based configuration of GoogleAnalyticsPlugin by adding :
5656 ```yaml
5757 spinbits_sylius_google_analytics4:
58- id: "%env(TAG_MANAGER_ID)%"
58+ id: "%env(TAG_MANAGER_ID)%"
59+ templateName: "@BitBagSyliusUserComPlugin/_userComScripts.html.twig"
60+ enabled: true
5961 ```
62+ 7. Add api credentials to your channel configuration in admin panel. If you decided to extend different object, please make sure that api credentials are set
63+
64+ 8. While integrating with User.com via GTM, you can use `user_com_customer_info` in browser console to check currently logged in customer data.
Original file line number Diff line number Diff line change 1313
1414interface UserComApiAwareInterface
1515{
16- public function getId (): mixed ;
16+ /**
17+ * To ensure compatibility with ResourceInterface, return type must be missing
18+ *
19+ * @phpstan-ignore-next-line
20+ */
21+ public function getId ();
1722
1823 public function getUserComUrl (): ?string ;
1924
Original file line number Diff line number Diff line change 2424 {% endif %}
2525 </script >
2626{% endif %}
27+
28+ <!-- Google tag (gtag.js), plugin provided by Spinbits -->
29+ {% dump %}
30+ <script async src =" https://www.googletagmanager.com/gtag/js?id={{ id }}{{ url_suffix | raw }}" ></script >
31+ <script >
32+ window .dataLayer = window .dataLayer || [];
33+ function gtag (){window .dataLayer .push (arguments );}
34+ gtag (' js' , new Date ());
35+ gtag (' config' , ' {{ id }}' );
36+ if (window .performance ) {
37+ gtag (' event' , ' timing_complete' , {
38+ ' name' : ' load' ,
39+ ' value' : Math .round (performance .now ()),
40+ ' event_category' : ' JS Dependencies'
41+ });
42+ }
43+ {% if app .session is not null and app .session .started %}
44+ {% set events = app .session .bag (' spinbits_ga4_events' ).all %}
45+ {% for event , content in events %}
46+ {% for c in content %}
47+ gtag (" event" , " {{ event }}" , {{ c| raw }});
48+ {% endfor %}
49+ {% endfor %}
50+ console .log ({{ events| json_encode| raw }})
51+ {% endif %}
52+ </script >
Original file line number Diff line number Diff line change @@ -24,3 +24,8 @@ sylius_channel:
2424 channel :
2525 classes :
2626 model : Tests\BitBag\SyliusUserComPlugin\Entity\Channel
27+
28+ spinbits_sylius_google_analytics4 :
29+ id : " %env(TAG_MANAGER_ID)%"
30+ templateName : " @BitBagSyliusUserComPlugin/_userComScripts.html.twig"
31+ enabled : true
Original file line number Diff line number Diff line change @@ -5,8 +5,3 @@ sylius_ui:
55 user_com_configuration :
66 template : ' @BitBagSyliusUserComPlugin/UserApiResource/_userComCredentials.html.twig'
77 priority : 25
8- sylius.shop.layout.stylesheets :
9- blocks :
10- user_com :
11- template : ' @BitBagSyliusUserComPlugin/_userComScripts.html.twig'
12- priority : 25
You can’t perform that action at this time.
0 commit comments