Skip to content

Instantly share code, notes, and snippets.

@dan-donica
dan-donica / fb_event_id.js
Created September 20, 2023 12:30
FB Event ID
<!-- Begin "Facebook event deduplication" || Help center -->
<!-- Add to Settings->Javascript->Footer -->
<!-- CS:20210930-27-1 -->
<script>
function createUUID(){
let dt = new Date().getTime()
const uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
const r = (dt + Math.random()*16)%16 | 0
dt = Math.floor(dt/16)
@dan-donica
dan-donica / add_click_to_call-email-or-message_to_page.js
Created September 20, 2023 12:19
HC || Add click to call, email or message to your page
<!-- Begin "Add click to call, email or message to your page" || Help center -->
<!-- Add to Settings->Javascript->Footer -->
<!-- CS:20201016-26-1 -->
<script>
document.addEventListener("DOMContentLoaded", function(){
// Handler when the DOM is fully loaded
var link_to_fix = document.querySelector('#element-2 a');
var current_href = link_to_fix.getAttribute('href')
fixed_href = current_href.replace('http://', '');
link_to_fix.setAttribute('href', fixed_href);
@dan-donica
dan-donica / remove-email-number-validation-on-fields.js
Last active May 28, 2024 13:57
HC || Remove email/number validation on selected fields
<!-- Begin "Remove number validation on selected fields" || Help center -->
<!-- Add to Settings->Javascript->Footer -->
<!-- CS:20200929-25-1 -->
<script>
var remove_validation = ['Number one', 'Number Two'];
setTimeout(function(){
Object.keys(window.__validators).forEach(function (item) {
Object.keys(window.__validators[item].inputs).forEach(function (input) {
@dan-donica
dan-donica / fix-height-of-html-widget-to-chidren-elements.js
Created September 20, 2023 12:18
HC || Fix height of HTML widget to children elements
<!-- Begin "Fix height of HTML widget to children elements" || Help center -->
<!-- Add to Settings->Javascript->Footer -->
<!-- CS:20201028-24-1 -->
<script>
document.addEventListener('DOMContentLoaded', function() {
setTimeout(function(){
fixEmbededHeight()
}, 3000); // wait 3s for all children to fully load
});
@dan-donica
dan-donica / multiple-widgets-trigger-same-pop_up.js
Created September 20, 2023 12:16
HC || Multiple widgets trigger the same pop-up
<!-- Begin "Multiple widgets trigger the same pop-up" || Help center -->
<!-- Add to Settings->Javascript->Head -->
<!-- CS:20200925-23-1 -->
<script>
document.addEventListener("DOMContentLoaded", function(){
// selector for links that will open the pop-up
var elements = document.querySelectorAll("#element-1, #element-8, #element-9");
elements.forEach(function(elem) {
@dan-donica
dan-donica / amp-cookie-bar-translation.css
Created September 20, 2023 12:16
HC || AMP Cookie Bar Translation Script
@dan-donica
dan-donica / twitter-cards.html
Created September 20, 2023 12:12
HC || How can I implement Twitter Cards code on my landing page?
<meta name="twitter:card" content="summary" />
<meta name="twitter:site" content="@flickr" />
<meta name="twitter:title" content="Small Island Developing States Photo Submission" />
<meta name="twitter:description" content="View the album on Flickr." />
<meta name="twitter:image" content="https://farm6.staticflickr.com/5510/14338202952_93595258ff_z.jpg" />
@dan-donica
dan-donica / Webhooks PHP sample.php
Created September 20, 2023 12:10
HC || Integrating with Webhooks
<?php
// If you created a login form with fields
// 'Your email' and 'Your password',
// then you will map these fields to:
'Your email' => 'email'
'Your password' => 'password'
// Then after submit in your endpoint you can
// get these data with code:
@dan-donica
dan-donica / MOVology-tag-configuration.js
Created September 20, 2023 12:07
Missing - HC || Integrating with MOVology
<script>
window.movInit = function () {
MOV.init({
clientId: '<clientID>'
});
};
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) { return; }
@dan-donica
dan-donica / HC || Integrating with Instiller - 2.txt
Created September 20, 2023 12:04
HC || Integrating with Instiller - 2
{
"action": "TRIGGERED",
"journey_id": 4399479,
"workflow_description": "Your Workflow description",
"workflow_status": "ACTIVE",
"workflow_status_message": "Workflow triggered successfully.",
"user_id": 157450,
"email_address": "someone@somedomain.com",
"contact_reference_code": ABC-123
}