Skip to content

Instantly share code, notes, and snippets.

View cougrimes's full-sized avatar

Casey Grimes cougrimes

View GitHub Profile
@cougrimes
cougrimes / lib-singlepageapp.js
Last active September 10, 2020 17:03
I got frustrated by the lack of more intuitive single-page app tracking in Tealium and wrote a hacky workaround. Use at your own discretion.
/* Welcome to lib-singlepageapp.js! This script is meant to handle using single-page
applications (SPAs) for Tealium when you do not have direct access to Angular, Vue,
React, etc. for making modifications. This allows us to get around limitations of
utag.view(). The trigger in this case is a global event listener that evaluates
any time there is a click, HTML5 history API replacement, load event, or DOMContentLoaded
event. If a new URL is populated via the history API, we'll treat that as a "pageview".
Note in this case that I have defined a UDO variable of page. This variable is then mapped
to anything requiring a page URL. For example, in GA I have this variable mapped to
config.page_location so it acts like a native page URL view.*/
@cougrimes
cougrimes / monospace.gs
Created December 11, 2020 19:29
A Google Apps script for creating custom monospace styles in documents. Pair with a macro editor to use as a keyboard shortcut!
/* Welcome to monospace.gs, a script that handles standardizing formatting for items
needing monospace formatting in documents. Note that if you are wanting to share
large code blocks, you likely should install the following add-on:
https://workspace.google.com/marketplace/app/code_blocks/100740430168
This plugin is meant more for psuedocode and inline markup of code elements in
documentation. Use https://www.autocontrol.app/ to assign a keyboard shortcut for
the script's behavior. Enjoy! */
// Add new menu item
MktoForms2.whenReady(function (form){
var domains = ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com","google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com","live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk", "email.com", "games.com", "gmx.net", "hush.com", "hushmail.com", "icloud.com", "inbox.com","lavabit.com", "love.com" , "outlook.com", "pobox.com", "rocketmail.com" ,"safe-mail.net", "wow.com", "ygm.com", "ymail.com" , "zoho.com", "fastmail.fm","yandex.com","iname.com","bellsouth.net", "charter.net", "cox.net", "earthlink.net", "juno.com","btinternet.com", "virginmedia.com", "blueyonder.co.uk", "freeserve.co.uk", "live.co.uk","ntlworld.com", "o2.co.uk", "orange.net", "sky.com", "talktalk.co.uk", "tiscali.co.uk","virgin.net", "wanadoo.co.uk", "bt.com", "sina.com", "qq.com", "naver.com", "hanmail.net", "daum.net", "nate.com", "yahoo.co.jp", "yahoo.co.kr", "yahoo.co.id", "yahoo.co.in", "yahoo.com.sg", "yahoo.c
@cougrimes
cougrimes / marketo-form-confirmation.html
Created October 20, 2017 20:41
Show message on same page after successful form submission.
<div class="container">
<script src="//app-abc.marketo.com/js/forms2/js/forms2.min.js"></script>
<form id="mktoForm_27"></form>
<script>MktoForms2.loadForm("//app-abc.marketo.com", "123-ABC-456", 1);</script>
<div id="confirmation" aria-hidden="true" style="display:none;">
<p>This is a sample thank you message. Thanks for viewing.</p>
</div>
</div>
<script>
MktoForms2.whenReady(function (form){
@cougrimes
cougrimes / marketo-form-ga.js
Created October 20, 2017 20:29
Send Google Analytics event on Marketo form submission
MktoForms2.whenReady(function(form) {
form.onSuccess(function(vals, page) {
ga('send', 'event', {
eventCategory: 'Marketo Form',
eventAction: 'Form Submission',
eventLabel: formName,
hitCallback: function() {
document.location.href = page;
};
});
@cougrimes
cougrimes / utm-parser-marketo.js
Last active November 8, 2022 14:36
UTM Parser for Marketo
//First, let's get the URI and have it split out all parameters
var getURLParams = function() {
var temp = {};
document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function() {
var decode = function(s) {
return decodeURIComponent(s.split("+").join(" "));
};
temp[decode(arguments[1])] = decode(arguments[2]);
});
@cougrimes
cougrimes / marketo-country-iso.txt
Created June 17, 2015 22:31
Marketo Forms 2.0 ISO-3166 alpha-2 conversions for Country Fields
United States of America|US
Canada|CA
Afghanistan|AF
Åland Islands|AX
Albania|AL
Algeria|DZ
American Samoa|AS
Andorra|AD
Angola|AO
Anguilla|AI
@cougrimes
cougrimes / marketo_default_activity_types.json
Last active December 21, 2022 18:38
This is a reference for the default Marketo activity schema deployed to instances. Never run a call just to remember what activity type "send alert" is again!
{
"requestId":"this sure is fake",
"result":[
{
"id":1,
"name":"Visit Webpage",
"description":"User visits a web page",
"primaryAttribute":{
"name":"Webpage ID",
"dataType":"integer"
@cougrimes
cougrimes / NormalizeMktoForms.css
Last active January 17, 2023 19:17
Marketo Form Normalizer--making things actually responsive.
.mktoForm, .mktoForm .mktoFieldWrap, .mktoForm .mktoHtmlText, .mktoForm input, .mktoLogicalField .mktoCheckboxList, .mktoRangeField, .mktoRangeValue {width:100% !important;}
@media only screen and (min-width:480px) {
.mktoFormCol:first-child:nth-last-child(2), .mktoFormCol:first-child:nth-last-child(2) ~ .mktoFormCol {width: 100% !important;}
.mktoFormCol:first-child:nth-last-child(3), .mktoFormCol:first-child:nth-last-child(3) ~ .mktoFormCol {width: 50% !important;}
.mktoFormCol:first-child:nth-last-child(4), .mktoFormCol:first-child:nth-last-child(4) ~ .mktoFormCol {width: 33.3333% !important;}
.mktoFormCol:first-child:nth-last-child(3) ~ .mktoFormCol {padding-left: 0.3em !important;}
}
@media only screen and (max-width:480px) {.mktoFormCol {width:100% !important;}}
.mktoAsterix{display:none !important;}
.mktoForm .mktoGutter {display:none !important;}
@cougrimes
cougrimes / velocity-marketo-npp.xml
Created July 3, 2017 17:29
Velocity syntax highlighting for Notepad++, Marketo-specific
<NotepadPlus>
<UserLang name="Velocity" ext="vm" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="no" Keywords2="yes" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="no" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">03#* 04*# 00## 01 02</Keywords>
<Keywords name="Numbers, prefix1"></Keywords>
<Keywords name="Numbers, prefix2"></Keywords>