Skip to content

Instantly share code, notes, and snippets.

View postman31's full-sized avatar

Dmytro Bulakh postman31

View GitHub Profile
@postman31
postman31 / ended-campaign.js
Last active April 2, 2018 14:25
simple function to check whether the campaign is ended
/**
* Checks if campaig has and end date later then today
*
* @return {string} 'ENDED' if true 'IN PROGRESS' otherwise.
* example usage:
* while (campaignIterator.hasNext()) {
* var campaign = campaignIterator.next();
* if (endedStatus(campaign) == 'ENDED') continue
* }
*/
function () {
var customTask = function(model) {
// if using other task then custom don't forget to save and call the original task
// save the original task
var originalOtherTask = model.get('checkProtocolTask')
var hitType = model.get('hitType');
if (hitType == 'event') {
var eventCategory = model.get('eventCategory')
var eventAction = model.get('eventAction')
}
@postman31
postman31 / pre-ga tag.HTML
Last active July 18, 2017 19:07
UA plugins with GTM
<script>
(function(i,s,o,g,r,a,m){ // Modified UA function to pre-set 'ga' queue forming.
var ga2fb = function(tracker) { // plugin constructor
this.tracker = tracker;
console.log('hello from constructor');
// Copy the original hit dispatch function
var originalSendHitTask = this.tracker.get('sendHitTask');
// Modify the existing hit dispatcher to log a copy of the hit
this.tracker.set('sendHitTask', function(model) {
<html>
<head>
<style media="screen">
.red {
background-color: #F55D5B;
padding: 30px;
}
.bordered {
border: 2px solid #518CB6;
<html>
<head>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
</script>
</head>
<body>
<html>
<head>
<!-- Google Analytics snippet -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
</script>
</head>