Skip to content

Commit 2e2dce7

Browse files
author
markzegarelli
authored
Merge pull request #2180 from segmentio/develop
Release 21.47.1
2 parents 9c48f94 + a4c6f4c commit 2e2dce7

File tree

16 files changed

+297
-39
lines changed

16 files changed

+297
-39
lines changed

js/code-copy/index.js

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
import tippy from 'tippy.js'
2+
3+
export default function () {
4+
5+
// get the list of all highlight code blocks
6+
const highlights = document.querySelectorAll("div.highlighter-rouge")
7+
8+
9+
10+
11+
highlights.forEach(div => {
12+
// create the copy button
13+
const copy = document.createElement("button")
14+
copy.innerHTML = "<img src='/docs/images/duplicate.svg' />"
15+
// add the event listener to each click
16+
copy.addEventListener("click", handleCopyClick)
17+
// append the copy button to each code block
18+
div.append(copy)
19+
20+
})
21+
22+
23+
24+
25+
26+
const copyToClipboard = str => {
27+
const el = document.createElement("textarea") // Create a <textarea> element
28+
el.value = str // Set its value to the string that you want copied
29+
el.setAttribute("readonly", "") // Make it readonly to be tamper-proof
30+
el.style.position = "absolute"
31+
el.style.left = "-9999px" // Move outside the screen to make it invisible
32+
document.body.appendChild(el) // Append the <textarea> element to the HTML document
33+
const selected =
34+
document.getSelection().rangeCount > 0 // Check if there is any content selected previously
35+
?
36+
document.getSelection().getRangeAt(0) // Store selection if found
37+
:
38+
false // Mark as false to know no selection existed before
39+
el.select() // Select the <textarea> content
40+
document.execCommand("copy") // Copy - only works as a result of a user action (e.g. click events)
41+
document.body.removeChild(el) // Remove the <textarea> element
42+
if (selected) {
43+
// If a selection existed before copying
44+
document.getSelection().removeAllRanges() // Unselect everything on the HTML document
45+
document.getSelection().addRange(selected) // Restore the original selection
46+
}
47+
}
48+
49+
50+
51+
function handleCopyClick(evt) {
52+
// get the children of the parent element
53+
const {
54+
children
55+
} = evt.target.parentElement.parentElement
56+
// grab the first element (we append the copy button on afterwards, so the first will be the code element)
57+
// destructure the innerText from the code block
58+
const {
59+
innerText
60+
} = Array.from(children)[0]
61+
// copy all of the code to the clipboard
62+
copyToClipboard(innerText)
63+
// alert to show it worked, but you can put any kind of tooltip/popup to notify it worked
64+
const alert = children[1]
65+
alert.classList.add("green")
66+
setTimeout(() => {
67+
alert.classList.remove("green")
68+
}, 700)
69+
}
70+
}

js/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import glightbox from './glightbox'
2222
import autocomplete from './algolia'
2323
import mapTable from './map-table'
2424
import expando from './expando'
25+
import codeCopy from './code-copy'
2526
feedback()
2627
accordion()
2728
accordionGroup()
@@ -44,4 +45,5 @@ tracking()
4445
searchBar()
4546
glightbox()
4647
mapTable()
47-
expando()
48+
expando()
49+
codeCopy()

src/_includes/content/snippet-helper.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{% codeexample %}
22
{% codeexampletab Minified %}
3-
```js
3+
```html
44
<script>
55
!function(){var analytics=window.analytics=window.analytics||[];if(!analytics.initialize)if(analytics.invoked)window.console&&console.error&&console.error("Segment snippet included twice.");else{analytics.invoked=!0;analytics.methods=["trackSubmit","trackClick","trackLink","trackForm","pageview","identify","reset","group","track","ready","alias","debug","page","once","off","on","addSourceMiddleware","addIntegrationMiddleware","setAnonymousId","addDestinationMiddleware"];analytics.factory=function(e){return function(){var t=Array.prototype.slice.call(arguments);t.unshift(e);analytics.push(t);return analytics}};for(var e=0;e<analytics.methods.length;e++){var key=analytics.methods[e];analytics[key]=analytics.factory(key)}analytics.load=function(key,e){var t=document.createElement("script");t.type="text/javascript";t.async=!0;t.src="https://cdn.segment.com/analytics.js/v1/" + key + "/analytics.min.js";var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(t,n);analytics._loadOptions=e};analytics._writeKey="YOUR_WRITE_KEY";analytics.SNIPPET_VERSION="4.15.2";
66
analytics.load("YOUR_WRITE_KEY");

src/_includes/menu/menu-strat.html

+7-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
{% assign sectionSlug = page.strat %}
22
{% assign ourSection = site.data.sidenav.strat.sections | where: "slug", sectionSlug %}
3+
{% assign type = page.url | split: "/" %}
34

45
<div class="sidebar sidebar--sticky sidebar--scroll sidebar--dark">
56
<div class="sidebar__content">
67
<nav class="menu">
78
<ul class="menu__list list list--unstyle">
89
<li class="menu-item">
9-
<a href="{{ site.baseurl }}/connections/destinations/catalog/" class="menu-item__link menu-item__link--small menu-item__link--back">
10+
<a href="{{ site.baseurl }}/connections/{{ type[2] }}/catalog/" class="menu-item__link menu-item__link--small menu-item__link--back">
1011
{% include icons/symbols/arrow-left.svg %}
1112
<span>Back to Connections</span>
1213
</a>
1314
</li>
1415
</ul>
1516
</nav>
16-
17+
1718
<nav class="menu menu--compact">
1819
<ul class="menu__list list list--unstyle">
1920
{% for item in ourSection %}
@@ -22,22 +23,22 @@
2223
<span class="flex__column">
2324
{{ item.section_title }}
2425
</span>
25-
26+
2627
<div class="menu-item__chevron flex__column flex__column--shrink">
2728
{% include icons/symbols/caret-down.svg %}
2829
</div>
2930
</button>
30-
31+
3132
<ul class="menu-item__body" data-ref="accordion[body]">
3233
{% for subsection in item.section %}
3334
{% if subsection.path %}
3435
{% assign menuLink = site.baseurl | append: subsection.path | append: "/" %}
35-
36+
3637
{% if subsection.path contains "http://" or subsection.path contains "https://"%}
3738
{% assign menuLink = subsection.path %}
3839
{% endif %}
3940
{% endif %}
40-
41+
4142
<li class="menu-item menu-item--compact">
4243
<a href="{{ menuLink }}" class="menu-item__link">
4344
{{ subsection.title }}

src/_sass/components/_markdown.scss

+40
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@
146146
}
147147
div.highlighter-rouge {
148148
margin: 15px auto;
149+
position: relative;
149150
}
150151
table {
151152
margin: 15px auto;
@@ -378,4 +379,43 @@ tr.show {
378379
max-height: 100%;
379380
transition: max-height .5s ease-in-out;
380381
}
382+
381383
}
384+
385+
div.highlighter-rouge {
386+
position: relative;
387+
388+
button {
389+
color: #adb5bd;
390+
box-sizing: border-box;
391+
transition: 0.2s ease-out;
392+
cursor: pointer;
393+
user-select: none;
394+
padding: 8px 10px;
395+
font-size: 0.8em;
396+
position: absolute;
397+
top: 0;
398+
right: 0;
399+
border-radius: 0 0.15rem;
400+
width: 40px;
401+
img {
402+
width: 16px;
403+
margin: 0;
404+
border: none;
405+
border-radius: 0px;
406+
}
407+
img:hover {
408+
filter: invert(65%) sepia(9%) saturate(784%) hue-rotate(192deg) brightness(91%) contrast(87%);
409+
transition: 0.2s ease-out;
410+
}
411+
412+
img:active {
413+
filter: invert(65%) sepia(9%) saturate(784%) hue-rotate(192deg) brightness(91%) contrast(87%);
414+
}
415+
}
416+
417+
.green{
418+
background-color: #BAE5D5;
419+
content: "copied!";
420+
}
421+
}

src/connections/destinations/catalog/actions-fullstory/index.md

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ hide-dossier: true
1414
> success ""
1515
> **Good to know**: This page is about the [Actions-framework](/docs/connections/destinations/actions/) FullStory Segment destination. There's also a page about the [non-Actions FullStory destination](/docs/connections/destinations/catalog/fullstory/). Both of these destinations receives data from Segment.
1616
17+
## Benefits of FullStory (Actions) vs FullStory Classic
18+
19+
- Greater control over the page properties you send.
20+
- Send events specific to individual pages.
21+
- Select by name the specific to send.
1722

1823

1924
## Getting started

src/connections/destinations/catalog/adobe-analytics/heartbeat.md

+37-16
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ options:@{
9797
9898
## Supported Video Events
9999
100-
Adobe Analytics supports many - but not all - of the [Segment video spec events](/docs/connections/spec/video/), however **some events required for Adobe Analytics are not included as part of Segment's standard video tracking**, so read the documentation closely. The list below shows supported events and the corresponding Adobe method(s) they trigger. The next section explains the function of each event in more detail, and lists any required properties.
100+
Adobe Analytics supports many - but not all - of the [Segment Video Spec events](/docs/connections/spec/video/), however **some events required for Adobe Analytics are not included as part of Segment's standard video tracking**, so read the documentation closely. The list below shows supported events and the corresponding Adobe method(s) they trigger. The next section explains the function of each event in more detail, and lists any required properties.
101101
102102
<table>
103103
<tr>
@@ -174,9 +174,11 @@ Adobe Analytics supports many - but not all - of the [Segment video spec events]
174174
</tr>
175175
</table>
176176
177+
On web, multiple video sessions can be open at once so video events must have a `session_id` property unique to the session the content belongs to. If a `session_id` is not included, Segment will send `default` as the [s:event:sid](https://experienceleague.adobe.com/docs/media-analytics/using/sdk-implement/validation/heartbeat-params.html?lang=en) and Adobe will create a new session. For more information on `session_id`, please visit [Segment's Video Spec](/docs/connections/spec/video/#playback).
178+
177179
### Video Playback Started
178180
179-
"Video Playback Started" is required to begin a new video session. This event **must** include the appropriate properties and options to configure the `MediaHeartbeat` instance for this video session. Although all the properties and options listed below are also **required**, you can also send additional standard and custom video properties with this event. See the [Custom Video Metadata section below.](#custom-video-metadata)
181+
"Video Playback Started" is required to begin a new video session. This event **must** include the appropriate properties and options to configure the `MediaHeartbeat` instance for this video session. Although all the properties and options listed below are also **required**, you can also send additional standard and custom video properties with this event. See the [Custom Video Metadata section below](#custom-video-metadata).
180182
181183
<table>
182184
<tr>
@@ -193,19 +195,23 @@ Adobe Analytics supports many - but not all - of the [Segment video spec events]
193195
</tr>
194196
<tr>
195197
<td>`properties.title`</td>
196-
<td>The title of the video session.</td>
198+
<td>The title of the video.</td>
197199
</tr>
198200
<tr>
199201
<td>`properties.contentAssetId`</td>
200-
<td>The unique id for the video session.</td>
202+
<td>The unique id for the video.</td>
201203
</tr>
202204
<tr>
203205
<td>`properties.totalLength`</td>
204-
<td>The total length in seconds of the video session.</td>
206+
<td>The total length in seconds of the video.</td>
205207
</tr>
206208
<tr>
207209
<td>`properties.livestream`</td>
208-
<td>Whether the session is a livestream (boolean).</td>
210+
<td>Whether the video is a livestream (boolean).</td>
211+
</tr>
212+
<tr>
213+
<td>`properties.session_id`</td>
214+
<td>The unique id for the session. Required for web.</td>
209215
</tr>
210216
<tr>
211217
<td>`options.ovp`</td>
@@ -215,7 +221,7 @@ Adobe Analytics supports many - but not all - of the [Segment video spec events]
215221
216222
### Video Playback Completed
217223
218-
This Segment event triggers an Adobe `trackSessionEnd()` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
224+
This Segment event triggers an Adobe `trackSessionEnd()` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
219225
220226
### Video Content Started
221227
@@ -242,35 +248,39 @@ This Segment event triggers an Adobe `trackSessionEnd()` event. You do not need
242248
<td>`properties.startTime`</td>
243249
<td>The position of the video playhead in seconds when the chapter starts playing.</td>
244250
</tr>
251+
<tr>
252+
<td>`properties.session_id`</td>
253+
<td>The unique id for the session. Required for web.</td>
254+
</tr>
245255
</table>
246256
247257
### Video Content Completed
248258
249-
This Segment event triggers an Adobe `trackEvent(chapterComplete)` event and a `trackComplete()` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
259+
This Segment event triggers an Adobe `trackEvent(chapterComplete)` event and a `trackComplete()` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
250260
251261
### Video Playback Paused
252262
253-
This Segment event triggers an Adobe `trackPause()` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
263+
This Segment event triggers an Adobe `trackPause()` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
254264
255265
### Video Playback Resumed
256266
257-
This Segment event triggers an Adobe `trackPlay()` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
267+
This Segment event triggers an Adobe `trackPlay()` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
258268
259269
### Video Playback Buffer Started
260270
261-
This Segment event triggers an Adobe `trackEvent(bufferStart)` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
271+
This Segment event triggers an Adobe `trackEvent(bufferStart)` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
262272
263273
### Video Playback Buffer Completed
264274
265-
This Segment event triggers an Adobe `trackEvent(bufferComplete)` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
275+
This Segment event triggers an Adobe `trackEvent(bufferComplete)` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
266276
267277
### Video Playback Seek Started
268278
269-
This Segment event triggers an Adobe `trackEvent(seekStart)` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
279+
This Segment event triggers an Adobe `trackEvent(seekStart)` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
270280
271281
### Video Playback Seek Completed
272282
273-
This Segment event triggers an Adobe `trackEvent(seekComplete)` event. To reconcile the new playhead position, you **must** pass this value as `seekPosition`.
283+
This Segment event triggers an Adobe `trackEvent(seekComplete)` event. On web, you must include a `session_id` property to tie this event to the correct video session. To reconcile the new playhead position, you **must** also pass the position as `seekPosition`.
274284
275285
<table>
276286
<tr>
@@ -304,11 +314,15 @@ This Segment event triggers an Adobe `trackEvent(adBreakStart)` event. This even
304314
<td>`properties.startTime`</td>
305315
<td>The position of the video playhead in seconds when the chapter starts playing.</td>
306316
</tr>
317+
<tr>
318+
<td>`properties.session_id`</td>
319+
<td>The unique id for the session. Required for web.</td>
320+
</tr>
307321
</table>
308322
309323
### Video Ad Break Completed
310324
311-
This Segment event triggers an Adobe `trackEvent(adBreakComplete)` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
325+
This Segment event triggers an Adobe `trackEvent(adBreakComplete)` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
312326
313327
### Video Ad Started
314328
@@ -335,11 +349,15 @@ This Segment event triggers an Adobe `trackEvent(adStart)` event. This event **m
335349
<td>`properties.totalLength`</td>
336350
<td>The total length of the ad in seconds.</td>
337351
</tr>
352+
<tr>
353+
<td>`properties.session_id`</td>
354+
<td>The unique id for the session. Required for web.</td>
355+
</tr>
338356
</table>
339357
340358
#### Video Ad Completed
341359
342-
This Segment event triggers an Adobe `trackEvent(adComplete)` event. You do not need to pass any properties along with this event. Properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
360+
This Segment event triggers an Adobe `trackEvent(adComplete)` event. On web, you must include a `session_id` property to tie this event to the correct video session. Any other properties passed to this event are not forwarded to Adobe (but are sent to other downstream destinations that support video events).
343361
344362
### Video Quality Updated
345363
@@ -358,6 +376,9 @@ This event is required to set quality of service information in the `MediaHeartb
358376
<tr>
359377
<td>`properties.droppedFrames`</td>
360378
</tr>
379+
<tr>
380+
<td>`properties.session_id` _Required for web. Defaults to `default` if missing._</td>
381+
</tr>
361382
</table>
362383
363384
## Standard Video Metadata

src/connections/destinations/catalog/hotjar/index.md

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ Hotjar automatically starts tracking visitors based on the tools you have enable
3333

3434
The Hotjar destination will automatically ingest a User ID, as well as values sent over your Identify spec as [traits](/docs/connections/spec/identify/#traits), as long as [User Attributes are enabled in Hotjar](https://help.hotjar.com/hc/en-us/articles/360038394053-How-to-Setup-User-Attributes-in-4-Steps#step-2-review-your-privacy-requirements-and-enable-user-attributes).
3535

36+
Identify calls that do not have a User ID value will not be sent to Hotjar.
37+
3638
### Nested values or lists
3739

3840
The Hotjar Identify API is unable to ingest values passed as nested objects or lists over your `identify` Spec:

0 commit comments

Comments
 (0)