Skip to content

Instantly share code, notes, and snippets.

View NickDeckerDevs's full-sized avatar

nicholas decker NickDeckerDevs

View GitHub Profile
@NickDeckerDevs
NickDeckerDevs / code.gs
Created December 6, 2022 16:28
google app script that scrapes a webpage (using column data) and then fills in content related to webpage
function onOpen() {
var ui = SpreadsheetApp.getUi();
ui.createMenu('Product Functions')
.addItem('Scrape Product SKUs', 'menuItem1')
.addSeparator()
.addSubMenu(ui.createMenu('Clean Up')
.addItem('Second item', 'menuItem2'))
.addToUi();
}
@NickDeckerDevs
NickDeckerDevs / list-hubspot-pages-to-csv.js
Created December 1, 2022 17:52
website pages / landing pages inhubspot, run in console after opening up to 100 pages, will be able to copy/paste out the data into vscode, then find/replace the VM..... text with blank
document.querySelectorAll('.content-table-row').forEach(item => {
let linktext = item.querySelector('a').innerText
let linkedit = item.querySelector('a').href
let linkurl = item.querySelector('.private-microcopy.is--text--help').innerText
let status = item.querySelector('[data-test-id="content-status-cell"]').innerText
console.log(`${linktext},https://${linkurl},${linkedit},${status}`)
})
@NickDeckerDevs
NickDeckerDevs / hubspot-gdpr-script.js
Created September 28, 2022 14:29
hubpsot gdpr api script
var _hsp = window._hsp = window._hsp || []
window.dataLayer = window.dataLayer || []
_hsp.push(['addPrivacyConsentListener', function(consent) {
// console.log('-------- [HubSpot website logging start] --------')
// console.log('analytics: ' + consent.categories.analytics)
// console.log('advertisement: ' + consent.categories.advertisement)
// console.log('functionality: ' + consent.categories.functionality)
// console.log('-------- [HubSpot website logging start] --------')
if(consent.categories.analytics) {
@NickDeckerDevs
NickDeckerDevs / hubl.html
Created September 25, 2022 00:19
hubl for blog tag and hubdb comparison -- using a made up object to represent the hubdb table
{% set tags_from_blog_post = ['Inspiration','Teambuilding'] %}
{# this set ebooks would actually be from your HUBDB call #}
{% set ebooks = [
{
"name": "fred",
"tags": "smile, Brains",
},
{
"name": "correct",
"tags": "Inspiration, Brains",
const hubspot = require('@hubspot/api-client');
exports.main = async (event, callback) => {
// not sure what you are doing here but putting this in a function seems better to me then the pasta
const handleQuote = (quoteObject) => {
// insert my cool code here that does stuff
}
// you should convert this to private app see: https://deckerdevs.com/blogs/hubspot-api-integrations-faqs-sunsetting-api-keys-for-private-apps
@NickDeckerDevs
NickDeckerDevs / index.js
Last active March 1, 2023 13:55
hubspot video status handling? via Stuart Grant - Dev @ King Post Studio, LLC (hubspot dev slack)
const SET_PLAYER_STATUS = 'SET_PLAYER_STATUS';
const hsVideos = window.hsVideoApi?.getPlayers();
const videoEls = document.querySelectorAll('.video-container');
function manageVideoStatus() {
videoEls.forEach((videoEl) => {
const iframe = videoEl.querySelector('iframe');
if (iframe) {
const videoId = iframe.getAttribute('id')?.replace('hs_player_', '');
@NickDeckerDevs
NickDeckerDevs / workflow.js
Last active September 4, 2022 15:06
bare minimum for hubspot custom object creation
const hubspot = require('@hubspot/api-client')
const hubspotClient = new hubspot.Client({
"accessToken": process.env.PRIVATE_APP_TOKEN
})
const labels = {
"singular": "Property",
"plural": "Properites"
};
@NickDeckerDevs
NickDeckerDevs / hubspot-gdpr-api.js
Created August 23, 2022 14:58
hubspot gdpr acceptance api using all of the module options -- easy to implement. This sends a message to google tag manager where you set up a custom event ot read, thent trigger other tags. You can also use this to fire off your own script tags in hubspot
var _hsp = window._hsp = window._hsp || []
window.dataLayer = window.dataLayer || []
_hsp.push(['addPrivacyConsentListener', function(consent) {
// console.log('-------- [HubSpot website logging start] --------')
// console.log('analytics: ' + consent.categories.analytics)
// console.log('advertisement: ' + consent.categories.advertisement)
// console.log('functionality: ' + consent.categories.functionality)
// console.log('-------- [HubSpot website logging start] --------')
if(consent.categories.analytics) {
@NickDeckerDevs
NickDeckerDevs / lazy-load-form-husbpot.html
Last active July 13, 2022 18:33
lazy load hubspot form
<div class="form-module__form ll"></div>
<script id="form-module__script" charset="utf-8" type="text/javascript" data-src="//js.hsforms.net/forms/v2.js" data-targetclass="form-module__form" data-portal="{{ portalId }}" data-form="{{ module.module_content.form_field.form_id }}" defer></script>
<script>
function getFormData(formScript) {
return {
id: formScript.dataset.form,
portal: formScript.dataset.portal,
targetClass: "." + formScript.dataset.targetclass
@NickDeckerDevs
NickDeckerDevs / form-observer.js
Last active June 29, 2022 13:53
hubspot form observer message emit
window.addEventListener('message', function (event) {
if (event.data.type === 'hsFormCallback' && event.data.eventName === 'onFormReady') {
// hubspot form is Loaded
}
})