@mindful-web/marko-web-gtm 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/.eslintignore +1 -0
  2. package/LICENSE +21 -0
  3. package/README.md +65 -0
  4. package/browser/.eslintrc.js +1 -0
  5. package/browser/index.js +14 -0
  6. package/browser/track-bus-event.vue +61 -0
  7. package/browser/track-in-view-event.vue +45 -0
  8. package/browser/track-load-more.vue +25 -0
  9. package/components/context/content.marko +97 -0
  10. package/components/context/content.marko.js +144 -0
  11. package/components/context/default.marko +9 -0
  12. package/components/context/default.marko.js +41 -0
  13. package/components/context/dynamic-page.marko +28 -0
  14. package/components/context/dynamic-page.marko.js +75 -0
  15. package/components/context/magazine-issue.marko +30 -0
  16. package/components/context/magazine-issue.marko.js +77 -0
  17. package/components/context/magazine-publication.marko +25 -0
  18. package/components/context/magazine-publication.marko.js +72 -0
  19. package/components/context/marko.json +44 -0
  20. package/components/context/native-x-story.marko +9 -0
  21. package/components/context/native-x-story.marko.js +41 -0
  22. package/components/context/website-section.marko +32 -0
  23. package/components/context/website-section.marko.js +79 -0
  24. package/components/init.marko +52 -0
  25. package/components/init.marko.js +104 -0
  26. package/components/marko.json +61 -0
  27. package/components/noscript.marko +11 -0
  28. package/components/noscript.marko.js +44 -0
  29. package/components/push.marko +7 -0
  30. package/components/push.marko.js +35 -0
  31. package/components/slot.marko +9 -0
  32. package/components/slot.marko.js +40 -0
  33. package/components/start.marko +7 -0
  34. package/components/start.marko.js +37 -0
  35. package/components/track-bus-event.marko +1 -0
  36. package/components/track-bus-event.marko.js +30 -0
  37. package/components/track-inview-event.marko +1 -0
  38. package/components/track-inview-event.marko.js +30 -0
  39. package/components/track-load-more.marko +1 -0
  40. package/components/track-load-more.marko.js +30 -0
  41. package/context/content.js +74 -0
  42. package/context/default.js +11 -0
  43. package/context/dynamic-page.js +17 -0
  44. package/context/index.js +17 -0
  45. package/context/magazine-issue.js +22 -0
  46. package/context/magazine-publication.js +15 -0
  47. package/context/native-x-story.js +37 -0
  48. package/context/website-section.js +24 -0
  49. package/marko.json +6 -0
  50. package/package.json +31 -0
  51. package/scss/slot.scss +7 -0
  52. package/utils/build-query-string.js +3 -0
package/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ *.marko.js
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Parameter1 LLC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,65 @@
1
+ # Mindful Web Marko Web GTM Components
2
+ Google Tag Manager components for Mindful Web/Marko websites.
3
+
4
+ ## Installation
5
+ Once you have a GTM container ID, you can enable GTM in your mindful-web-marko-web application. To do so, include this package and add the following two tags to your app:
6
+
7
+ ## Usage: Marko
8
+
9
+ ### `marko-web-gtm-init`
10
+ This component initializes the GTM container(s) specified, and allows a standard set of inputs to be used for projects utilizing this package solo and for projects using the `marko-web-deferred-script-loader` package.
11
+
12
+ To load GTM normally, include the following calls, specifying only your container id(s) and any of the optional arguments: `start`, `push`:
13
+ ```marko
14
+ <marko-web-document ...input>
15
+ <@head>
16
+ <marko-web-gtm-init container-id="GTM-XXXXXX" start=true />
17
+ <${input.head} />
18
+ </@head>
19
+ <@above-wrapper>
20
+ <marko-web-gtm-noscript container-id="GTM-XXXXXX" />
21
+ </@above-wrapper>
22
+ </marko-web-document>
23
+ ```
24
+
25
+ To defer GTM, ensure the `marko-web-deferred-script-loader` package is installed and enabled, and then specify the relevant `on`, `request-frame`, and `target-tag` parameters along with your component call.
26
+ ```marko
27
+ <marko-web-document ...input>
28
+ <@head>
29
+ <marko-web-gtm-init
30
+ container-id="GTM-XXXXXX"
31
+ start=true
32
+ on="load"
33
+ request-frame=true
34
+ target-tag="body"
35
+ />
36
+ <${input.head} />
37
+ </@head>
38
+ <@above-wrapper>
39
+ <marko-web-gtm-noscript container-id="GTM-XXXXXX" />
40
+ </@above-wrapper>
41
+ </marko-web-document>
42
+ ```
43
+
44
+ To specify an alternative datalayer name, use the `name="fooLayer"` parameter1.
45
+
46
+ To pre-push data to the datalayer, you can use the `push={ foo: 'bar' }` parameter. See the `marko-web-gtm-push` component for more details.
47
+
48
+ To automatically start your containers, send the `start=true` parameter with your `init` component. Otherwise, you must manually start the GTM container with the `marko-web-gtm-start` component.
49
+
50
+ ### `marko-web-gtm-noscript`
51
+
52
+ ### `marko-web-gtm-start`
53
+ ### `marko-web-gtm-push`
54
+ ### `marko-web-gtm-slot`
55
+ ### `marko-web-gtm-track-bus-event`
56
+ ### `marko-web-gtm-track-inview-event`
57
+ ### `marko-web-gtm-track-load-more`
58
+
59
+ ## Usage: Vue/Browser
60
+
61
+ ### `track-bus-event`
62
+
63
+ ### `track-in-view-event`
64
+
65
+ ### `track-load-more`
@@ -0,0 +1 @@
1
+ module.exports = require('../../../eslintrc.browser');
@@ -0,0 +1,14 @@
1
+ const GTMTrackInViewEvent = () => import(/* webpackChunkName: "gtm-track-in-view-event" */ './track-in-view-event.vue');
2
+ const GTMTrackLoadMore = () => import(/* webpackChunkName: "gtm-track-load-more" */ './track-load-more.vue');
3
+ const GTMTrackBusEvent = () => import(/* webpackChunkName: "gtm-track-bus-event" */ './track-bus-event.vue');
4
+
5
+ export default (Browser) => {
6
+ const { EventBus } = Browser;
7
+ Browser.register('GTMTrackInViewEvent', GTMTrackInViewEvent);
8
+ Browser.register('GTMTrackLoadMore', GTMTrackLoadMore, {
9
+ provide: { EventBus },
10
+ });
11
+ Browser.register('GTMTrackBusEvent', GTMTrackBusEvent, {
12
+ provide: { EventBus },
13
+ });
14
+ };
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <div
3
+ class="marko-web-gtm-track-bus-event"
4
+ :data-on="on"
5
+ :data-event-name="eventName"
6
+ :data-layer-name="layerName"
7
+ style="display: none;"
8
+ />
9
+ </template>
10
+
11
+ <script>
12
+ export default {
13
+ inject: ['EventBus'],
14
+ props: {
15
+ /**
16
+ * The name of the data layer.
17
+ */
18
+ layerName: {
19
+ type: String,
20
+ default: 'dataLayer',
21
+ },
22
+
23
+ /**
24
+ * The EventBus event name.
25
+ */
26
+ on: {
27
+ type: String,
28
+ required: true,
29
+ },
30
+
31
+ /**
32
+ * The event name to send to GTM.
33
+ */
34
+ eventName: {
35
+ type: String,
36
+ default: null,
37
+ },
38
+
39
+ /**
40
+ * Whether to clear the data layer after firing the event,
41
+ */
42
+ clearData: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ },
47
+ created() {
48
+ const { on } = this;
49
+ if (on) {
50
+ const eventName = this.eventName || on;
51
+ this.EventBus.$on(on, (data) => {
52
+ const dataLayer = window[this.layerName];
53
+ if (dataLayer) {
54
+ dataLayer.push({ [eventName]: data, event: eventName });
55
+ if (this.clearData) dataLayer.push({ [eventName]: undefined, event: undefined });
56
+ }
57
+ });
58
+ }
59
+ },
60
+ };
61
+ </script>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <div :id="elementId" class="lazyload" :data-expand="expand" />
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ props: {
8
+ name: {
9
+ type: String,
10
+ default: 'dataLayer',
11
+ },
12
+ event: {
13
+ type: String,
14
+ required: true,
15
+ },
16
+ expand: {
17
+ type: Number,
18
+ default: -100,
19
+ },
20
+ vars: {
21
+ type: Object,
22
+ default: () => ({}),
23
+ },
24
+ },
25
+ computed: {
26
+ elementId() {
27
+ return `gtm-track-in-view-event-${Date.now()}`;
28
+ },
29
+ },
30
+ created() {
31
+ document.addEventListener('lazybeforeunveil', this.lazyload.bind(this));
32
+ },
33
+ methods: {
34
+ lazyload({ target }) {
35
+ if (target.id === this.elementId) this.track();
36
+ },
37
+ track() {
38
+ const dataLayer = window[this.name];
39
+ if (!dataLayer) return;
40
+ const data = { event: this.event, ...this.vars };
41
+ dataLayer.push(data);
42
+ },
43
+ },
44
+ };
45
+ </script>
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <div class="marko-web-gtm-track-load-more" />
3
+ </template>
4
+
5
+ <script>
6
+ export default {
7
+ inject: ['EventBus'],
8
+ props: {
9
+ name: {
10
+ type: String,
11
+ default: 'dataLayer',
12
+ },
13
+ event: {
14
+ type: String,
15
+ default: 'page_load',
16
+ },
17
+ },
18
+ created() {
19
+ this.EventBus.$on('load-more-in-view', ({ data }) => {
20
+ const dataLayer = window[this.name];
21
+ if (dataLayer) dataLayer.push({ ...data, event: this.event });
22
+ });
23
+ },
24
+ };
25
+ </script>
@@ -0,0 +1,97 @@
1
+ import gql from "graphql-tag";
2
+ import { isFunction, warn } from "@mindful-web/utils";
3
+ import { contentBuilder } from "../../context";
4
+
5
+ $ const { req } = out.global;
6
+ $ const { id } = input;
7
+ $ const builder = isFunction(input.builder) ? input.builder : contentBuilder;
8
+
9
+ $ const queryFragment = input.queryFragment || gql`
10
+ fragment ContentContextFragment on Content {
11
+ id
12
+ type
13
+ name
14
+ labels
15
+ siteContext {
16
+ path
17
+ }
18
+ published
19
+ createdBy {
20
+ id
21
+ username
22
+ firstName
23
+ lastName
24
+ }
25
+ company {
26
+ id
27
+ name
28
+ }
29
+ primarySection {
30
+ id
31
+ name
32
+ alias
33
+ fullName
34
+ hierarchy {
35
+ id
36
+ name
37
+ alias
38
+ }
39
+ }
40
+ taxonomy {
41
+ edges {
42
+ node {
43
+ id
44
+ type
45
+ name
46
+ fullName
47
+ }
48
+ }
49
+ }
50
+ userRegistration {
51
+ isCurrentlyRequired
52
+ accessLevels
53
+ }
54
+ ... on Authorable {
55
+ authors {
56
+ edges {
57
+ node {
58
+ id
59
+ name
60
+ }
61
+ }
62
+ }
63
+ }
64
+ websiteSchedules {
65
+ section {
66
+ id
67
+ name
68
+ }
69
+ }
70
+ emailSchedules {
71
+ id
72
+ deploymentDate
73
+ newsletter {
74
+ id
75
+ name
76
+ }
77
+ }
78
+ magazineSchedules {
79
+ id
80
+ issue {
81
+ id
82
+ name
83
+ mailDate(input: {format:"MM/DD/YYYY"})
84
+ }
85
+ }
86
+ }
87
+ `;
88
+
89
+ <if(id)>
90
+ <marko-web-query|{ node }| name="content" params={ id, queryFragment }>
91
+ $ const context = builder({ type: "content", obj: node, req });
92
+ <${input.renderBody} context=context />
93
+ </marko-web-query>
94
+ </if>
95
+ <else>
96
+ $ warn('Unable to create GTM content context: no content id was provided.');
97
+ </else>
@@ -0,0 +1,144 @@
1
+ // Compiled using marko@4.20.2 - DO NOT EDIT
2
+ "use strict";
3
+
4
+ var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
+ marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/context/content.marko",
6
+ marko_component = require("./content.marko"),
7
+ marko_renderer = require("marko/dist/runtime/components/renderer"),
8
+ module_gql = require("graphql-tag"),
9
+ gql = module_gql.default || module_gql,
10
+ module_utils_module = require("@mindful-web/utils"),
11
+ utils_module = module_utils_module.default || module_utils_module,
12
+ isFunction = module_utils_module.isFunction,
13
+ warn = module_utils_module.warn,
14
+ module_context_module = require("../../context"),
15
+ context_module = module_context_module.default || module_context_module,
16
+ contentBuilder = module_context_module.contentBuilder,
17
+ marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
18
+ marko_web_query_template = require("@mindful-web/marko-core/components/queries/index.marko"),
19
+ marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
20
+ marko_web_query_tag = marko_loadTag(marko_web_query_template);
21
+
22
+ function render(input, out, __component, component, state) {
23
+ var data = input;
24
+
25
+ const { req } = out.global;
26
+
27
+ const { id } = input;
28
+
29
+ const builder = isFunction(input.builder) ? input.builder : contentBuilder;
30
+
31
+ const queryFragment = input.queryFragment || gql`
32
+ fragment ContentContextFragment on Content {
33
+ id
34
+ type
35
+ name
36
+ labels
37
+ siteContext {
38
+ path
39
+ }
40
+ published
41
+ createdBy {
42
+ id
43
+ username
44
+ firstName
45
+ lastName
46
+ }
47
+ company {
48
+ id
49
+ name
50
+ }
51
+ primarySection {
52
+ id
53
+ name
54
+ alias
55
+ fullName
56
+ hierarchy {
57
+ id
58
+ name
59
+ alias
60
+ }
61
+ }
62
+ taxonomy {
63
+ edges {
64
+ node {
65
+ id
66
+ type
67
+ name
68
+ fullName
69
+ }
70
+ }
71
+ }
72
+ userRegistration {
73
+ isCurrentlyRequired
74
+ accessLevels
75
+ }
76
+ ... on Authorable {
77
+ authors {
78
+ edges {
79
+ node {
80
+ id
81
+ name
82
+ }
83
+ }
84
+ }
85
+ }
86
+ websiteSchedules {
87
+ section {
88
+ id
89
+ name
90
+ }
91
+ }
92
+ emailSchedules {
93
+ id
94
+ deploymentDate
95
+ newsletter {
96
+ id
97
+ name
98
+ }
99
+ }
100
+ magazineSchedules {
101
+ id
102
+ issue {
103
+ id
104
+ name
105
+ mailDate(input: {format:"MM/DD/YYYY"})
106
+ }
107
+ }
108
+ }
109
+ `;
110
+
111
+ if (id) {
112
+ marko_web_query_tag({
113
+ collapsible: true,
114
+ name: "content",
115
+ params: {
116
+ id: id,
117
+ queryFragment: queryFragment
118
+ },
119
+ renderBody: function(out, { node }) {
120
+ const context = builder({ type: "content", obj: node, req });
121
+
122
+ marko_dynamicTag(out, input.renderBody, function() {
123
+ return {
124
+ context: context
125
+ };
126
+ }, null, null, null, __component, "1");
127
+ }
128
+ }, out, __component, "0");
129
+ } else {
130
+ warn('Unable to create GTM content context: no content id was provided.');
131
+ }
132
+ }
133
+
134
+ marko_template._ = marko_renderer(render, {
135
+ e_: marko_componentType
136
+ }, marko_component);
137
+
138
+ marko_template.meta = {
139
+ id: "/@mindful-web/marko-web-gtm$1.0.0/components/context/content.marko",
140
+ component: "./content.marko",
141
+ tags: [
142
+ "@mindful-web/marko-core/components/queries/index.marko"
143
+ ]
144
+ };
@@ -0,0 +1,9 @@
1
+ import { isFunction, warn } from "@mindful-web/utils";
2
+ import { defaultBuilder } from "../../context";
3
+
4
+ $ const { req } = out.global;
5
+ $ const builder = isFunction(input.builder) ? input.builder : defaultBuilder;
6
+ $ const type = input.type || "page";
7
+
8
+ $ const context = builder({ type, obj: input.obj, req });
9
+ <${input.renderBody} context=context />
@@ -0,0 +1,41 @@
1
+ // Compiled using marko@4.20.2 - DO NOT EDIT
2
+ "use strict";
3
+
4
+ var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
+ marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/context/default.marko",
6
+ marko_renderer = require("marko/dist/runtime/components/renderer"),
7
+ module_utils_module = require("@mindful-web/utils"),
8
+ utils_module = module_utils_module.default || module_utils_module,
9
+ isFunction = module_utils_module.isFunction,
10
+ warn = module_utils_module.warn,
11
+ module_context_module = require("../../context"),
12
+ context_module = module_context_module.default || module_context_module,
13
+ defaultBuilder = module_context_module.defaultBuilder,
14
+ marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag");
15
+
16
+ function render(input, out, __component, component, state) {
17
+ var data = input;
18
+
19
+ const { req } = out.global;
20
+
21
+ const builder = isFunction(input.builder) ? input.builder : defaultBuilder;
22
+
23
+ const type = input.type || "page";
24
+
25
+ const context = builder({ type, obj: input.obj, req });
26
+
27
+ marko_dynamicTag(out, input.renderBody, function() {
28
+ return {
29
+ context: context
30
+ };
31
+ }, null, null, null, __component, "0");
32
+ }
33
+
34
+ marko_template._ = marko_renderer(render, {
35
+ d_: true,
36
+ e_: marko_componentType
37
+ });
38
+
39
+ marko_template.meta = {
40
+ id: "/@mindful-web/marko-web-gtm$1.0.0/components/context/default.marko"
41
+ };
@@ -0,0 +1,28 @@
1
+ import gql from "graphql-tag";
2
+ import { isFunction, warn } from "@mindful-web/utils";
3
+ import { dynamicPageBuilder } from "../../context";
4
+
5
+ $ const { req } = out.global;
6
+ $ const { alias } = input;
7
+ $ const builder = isFunction(input.builder) ? input.builder : dynamicPageBuilder;
8
+
9
+ $ const queryFragment = input.queryFragment || gql`
10
+ fragment DynamicPageContextFragment on ContentPage {
11
+ id
12
+ name
13
+ alias
14
+ siteContext {
15
+ path
16
+ }
17
+ }
18
+ `;
19
+
20
+ <if(alias)>
21
+ <marko-web-query|{ node }| name="dynamic-page" params={ alias, queryFragment }>
22
+ $ const context = builder({ type: "dynamic-page", obj: node, req });
23
+ <${input.renderBody} context=context />
24
+ </marko-web-query>
25
+ </if>
26
+ <else>
27
+ $ warn('Unable to create GTM dynamic page context: no page alias was provided.');
28
+ </else>
@@ -0,0 +1,75 @@
1
+ // Compiled using marko@4.20.2 - DO NOT EDIT
2
+ "use strict";
3
+
4
+ var marko_template = module.exports = require("marko/dist/html").t(__filename),
5
+ marko_componentType = "/@mindful-web/marko-web-gtm$1.0.0/components/context/dynamic-page.marko",
6
+ marko_component = require("./dynamic-page.marko"),
7
+ marko_renderer = require("marko/dist/runtime/components/renderer"),
8
+ module_gql = require("graphql-tag"),
9
+ gql = module_gql.default || module_gql,
10
+ module_utils_module = require("@mindful-web/utils"),
11
+ utils_module = module_utils_module.default || module_utils_module,
12
+ isFunction = module_utils_module.isFunction,
13
+ warn = module_utils_module.warn,
14
+ module_context_module = require("../../context"),
15
+ context_module = module_context_module.default || module_context_module,
16
+ dynamicPageBuilder = module_context_module.dynamicPageBuilder,
17
+ marko_dynamicTag = require("marko/dist/runtime/helpers/dynamic-tag"),
18
+ marko_web_query_template = require("@mindful-web/marko-core/components/queries/index.marko"),
19
+ marko_loadTag = require("marko/dist/runtime/helpers/load-tag"),
20
+ marko_web_query_tag = marko_loadTag(marko_web_query_template);
21
+
22
+ function render(input, out, __component, component, state) {
23
+ var data = input;
24
+
25
+ const { req } = out.global;
26
+
27
+ const { alias } = input;
28
+
29
+ const builder = isFunction(input.builder) ? input.builder : dynamicPageBuilder;
30
+
31
+ const queryFragment = input.queryFragment || gql`
32
+ fragment DynamicPageContextFragment on ContentPage {
33
+ id
34
+ name
35
+ alias
36
+ siteContext {
37
+ path
38
+ }
39
+ }
40
+ `;
41
+
42
+ if (alias) {
43
+ marko_web_query_tag({
44
+ collapsible: true,
45
+ name: "dynamic-page",
46
+ params: {
47
+ alias: alias,
48
+ queryFragment: queryFragment
49
+ },
50
+ renderBody: function(out, { node }) {
51
+ const context = builder({ type: "dynamic-page", obj: node, req });
52
+
53
+ marko_dynamicTag(out, input.renderBody, function() {
54
+ return {
55
+ context: context
56
+ };
57
+ }, null, null, null, __component, "1");
58
+ }
59
+ }, out, __component, "0");
60
+ } else {
61
+ warn('Unable to create GTM dynamic page context: no page alias was provided.');
62
+ }
63
+ }
64
+
65
+ marko_template._ = marko_renderer(render, {
66
+ e_: marko_componentType
67
+ }, marko_component);
68
+
69
+ marko_template.meta = {
70
+ id: "/@mindful-web/marko-web-gtm$1.0.0/components/context/dynamic-page.marko",
71
+ component: "./dynamic-page.marko",
72
+ tags: [
73
+ "@mindful-web/marko-core/components/queries/index.marko"
74
+ ]
75
+ };
@@ -0,0 +1,30 @@
1
+ import gql from "graphql-tag";
2
+ import { isFunction, warn } from "@mindful-web/utils";
3
+ import { magazineIssueBuilder } from "../../context";
4
+
5
+ $ const { req } = out.global;
6
+ $ const { id } = input;
7
+ $ const builder = isFunction(input.builder) ? input.builder : magazineIssueBuilder;
8
+
9
+ $ const queryFragment = input.queryFragment || gql`
10
+ fragment MagazineIssueContextFragment on MagazineIssue {
11
+ id
12
+ name
13
+ canonicalPath
14
+ mailed
15
+ publication {
16
+ id
17
+ name
18
+ }
19
+ }
20
+ `;
21
+
22
+ <if(id)>
23
+ <marko-web-query|{ node }| name="magazine-issue" params={ id, queryFragment }>
24
+ $ const context = builder({ type: "magazine-issue", obj: node, req });
25
+ <${input.renderBody} context=context />
26
+ </marko-web-query>
27
+ </if>
28
+ <else>
29
+ $ warn('Unable to create GTM magazine issue context: no issue id was provided.');
30
+ </else>