pulumi / docs

All things Pulumi docs!
https://pulumi.com
Apache License 2.0
121 stars 207 forks source link

[Website] Add Common Room script to website #11996

Open calon-pulumi opened 2 weeks ago

calon-pulumi commented 2 weeks ago

Common Room app just added new features to capture web visits on our website.

From this guide, we'd like Step 1 and 2 followed. https://docs.commonroom.io/using-common-room/website-visitor-tracking/setup

Our unique web tracking script copied over from the app us:

<script> (function() { if (typeof window === 'undefined') return; if (typeof window.signals !== 'undefined') return; var script = document.createElement('script'); script.src = 'https://cdn.cr-relay.com/v1/site/a725b5ba-75f1-44dc-b250-11023fc10b9d/signals.js'; script.async = true; window.signals = Object.assign( [], ['page', 'identify', 'form'].reduce(function (acc, method){ acc[method] = function () { signals.push([method, arguments]); return signals; }; return acc; }, {}) ); document.head.appendChild(script); })(); </script>

cnunciato commented 2 weeks ago

Let's also as part of this make sure we can't include it with the Segment script, rather than use the additional script tag.

calon-pulumi commented 2 weeks ago

@cnunciato I did confirm from Common Room the below

"At the moment the easiest way to integrate Common Room SDK is to add the script snippet provided to your website. It tracks everything by default automatically. For tracking known contacts you'd need to add an identity call as well."

calon-pulumi commented 2 hours ago

@cnunciato I just wanted to check in on this if anything else you needed. Id like to also have this additional script deployed from RB2B. This in parallel to Common Room web visits should allow us to dynamically view people hitting our website that are known and anonymous. More info around RB2B if you needed it here

<script>!function () {var reb2b = window.reb2b = window.reb2b || []; if (reb2b.invoked) return;reb2b.invoked = true;reb2b.methods = ["identify", "collect"]; reb2b.factory = function (method) {return function () {var args = Array.prototype.slice.call(arguments); args.unshift(method);reb2b.push(args);return reb2b;};}; for (var i = 0; i < reb2b.methods.length; i++) {var key = reb2b.methods[i];reb2b[key] = reb2b.factory(key);} reb2b.load = function (key) {var script = document.createElement("script");script.type = "text/javascript";script.async = true; script.src = "https://s3-us-west-2.amazonaws.com/b2bjsstore/b/" + key + "/reb2b.js.gz"; var first = document.getElementsByTagName("script")[0]; first.parentNode.insertBefore(script, first);}; reb2b.SNIPPET_VERSION = "1.0.1";reb2b.load("Y4O7Z0HKLKNX");}();</script>