Created
November 6, 2018 11:58
-
-
Save frknbasaran/ddcf2ab387a76095bc57f5e8d7f2cb9b to your computer and use it in GitHub Desktop.
Full list of mapped GA actions to Countly.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Track pageview | |
*/ | |
// GA | |
ga('send', 'pageview', location.pathname); | |
// Mapped Countly Action | |
Countly.q.push(['track_pageview',location.pathname]); | |
/* | |
* Track pageview with custom page option | |
*/ | |
// GA | |
ga('set', 'page', '/new-page.html'); | |
ga('send', 'pageview'); | |
// Mapped Countly Action | |
Countly.q.push(['track_pageview', '/new-page.html']); | |
// GA | |
ga('send', { | |
hitType: 'pageview', | |
page: location.pathname | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['track_pageview', location.pathname]); | |
/* | |
* Event Tracking | |
*/ | |
// GA | |
ga('send', 'event', 'Videos', 'play', 'Fall Campaign'); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"play", | |
"count":1, | |
"segmentation":{ | |
"category":"videos", | |
"label":"Fall Campaign" | |
} | |
}]); | |
// GA (Event tracking with value) | |
ga('send', 'event', 'Videos', 'play', 'Fall Campaign', 5); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"play", | |
"count":5, | |
"segmentation":{ | |
"category":"Videos", | |
"label":"Fall Campaign" | |
} | |
}]); | |
// GA (Event tracking with value) | |
ga('send', { | |
hitType: 'event', | |
eventCategory: 'Videos', | |
eventAction: 'play', | |
eventLabel: 'Fall Campaign', | |
eventValue: 2 | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"play", | |
"count":5, | |
"segmentation":{ | |
"category":"Videos", | |
"label":"Fall Campaign" | |
} | |
}]); | |
/* | |
* Social Event Tracking | |
*/ | |
// GA | |
ga('send', 'social', 'Facebook', 'like', 'http://myownpersonaldomain.com'); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"like", | |
"count":1, | |
"segmentation":{ | |
"category":"Social", | |
"platform":"Facebook", | |
"target":"http://myownpersonaldomain.com" | |
} | |
}]); | |
// GA (Social tracking with JSON Object) | |
ga('send', { | |
hitType: 'social', | |
socialNetwork: 'Facebook', | |
socialAction: 'like', | |
socialTarget: 'http://myownpersonaldomain.com' | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"like", | |
"count":1, | |
"segmentation":{ | |
"category":"Social", | |
"playform":"facebook", | |
"target":"http://mypersonaldomain.com" | |
} | |
}]); | |
/* | |
* Screen Tracking | |
*/ | |
// GA | |
ga('send', 'screenview', { | |
screenName:'Login', | |
appName: 'DummyApp', | |
appVersion: 1.0, | |
appInstallerId: 1 | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"Screen View", | |
"count":1, | |
"segmentation":{ | |
"screenName":"Login", | |
"appName":"DummyApp", | |
"appVersion":1.0, | |
"appInstallerId":1 | |
} | |
}]); | |
/* | |
* Error & Exception Tracking | |
*/ | |
// GA | |
ga('send', 'exception', { | |
'exDescription': err.message, | |
'exFatal': false | |
}); | |
// Mapped Countly Action | |
Countly.log_error(err); | |
/* | |
* Track File Load Duration | |
*/ | |
// GA | |
ga('send', { | |
hitType: 'timing', | |
timingCategory: 'JS Dependencies', | |
timingVar: 'load', | |
timingValue: 3549 | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"load", | |
"count":1, | |
"dur":3549, | |
"segmentation":{ | |
"category":"JS dependency" | |
} | |
}]); | |
/* | |
* Custom Dimensions and Metrics w/ event | |
*/ | |
// GA | |
ga('send', 'event', 'category', 'action', { | |
'metric18': 8000 | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"action", | |
"count":1, | |
"segmentation":{ | |
"category":"category", | |
"metric18":8000 | |
} | |
}]); | |
/* | |
* Set Custom Property / Dimension | |
*/ | |
// GA | |
ga('set', 'dimension5', 'custom data'); | |
// Mapped Countly Action | |
Countly.q.push(['userData.set', 'dimension5', 'custom data']); | |
// GA (Set multiple dimension) | |
ga('set', { | |
'dimension5': 'custom dimension data', | |
'metric5': 'custom metric data' | |
}); | |
// Mapped Countly Action | |
Countly.q.push(["user_details", { | |
"custom":{ | |
"dimension5": "custom dimension data", | |
"metric5", "custom metric data" | |
} | |
}]); | |
/* | |
* E-commerce Add Transaction | |
*/ | |
// GA | |
ga('ecommerce:addTransaction', { | |
'id': '1234', // Transaction ID. Required. | |
'affiliation': 'Acme Clothing', // Affiliation or store name. | |
'revenue': '11.99', // Grand Total. | |
'shipping': '5', // Shipping. | |
'tax': '1.29' // Tax. | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"ecommerce:addTransaction", | |
"count":1, | |
"sum":11.99, | |
"segmentation":{ | |
"id":"1234", | |
"affiliation":"Acme Clothing", | |
"shipping":"5", | |
"tax":''1.29" | |
} | |
}]); | |
/* | |
* E-commerce Add Item to Cart | |
*/ | |
// GA | |
ga('ecommerce:addItem', { | |
'id': '1234', // Transaction ID. Required. | |
'name': 'Fluffy Pink Bunnies', // Product name. Required. | |
'sku': 'DD23444', // SKU/code. | |
'category': 'Party Toys', // Category or variation. | |
'price': '11.99', // Unit price. | |
'quantity': '5', // Quantity., | |
"currency": "EUR" // Currency | |
}); | |
// Mapped Countly Action | |
Countly.q.push(['add_event', { | |
"key":"ecommerce:addItem", | |
"count":5, | |
"sum":'11.99', | |
"segmentation":{ | |
"id":"1234", | |
"name":"Fluffy Pink Bunnies", | |
"sku":"DD23444", | |
"category":"Party Toys", | |
"currency": "EUR" | |
} | |
}]); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment