You can add any custom tracking code from 3rd party analytics software to track pageviews and conversions of your pages and registrations on ActivityHero. We support purchase conversion tracking on the following platforms. You will be able to see the number of purchases and the revenue from transactions processed on ActivityHero for your activities.
E-Commerce Tracking on Google Analytics - We track page views of your ActivityHero business page, activity page, cart page, checkout page, widget and purchase conversion events. You need to give us your Google Analytics (GA) account ID and add the activityhero.com domain in your GA code snippet below. You can find detailed documentation on cross-domain measurement in GA here.
ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['activityhero.com']);
Example of GA4 tracking information:
{
"domain": "website.com",
"ga4_id": "G-PC23DRV4F1"
}
Google Ads: We track purchase conversion on thank you page after the user completes a purchase of your activity. You need to give us your Google Ads conversion pixel.
Example of Google Ad conversion pixel:
{
"conversion_id": "AW-959013032",
"conversion_label": "FBtnCPjQhn4BssGlyQM"
}
URL Based Page View (Facebook tracking url or any other tracking url): We need a url, which is placed as an image pixel on you ActivityHero business page, activity page, cart page, checkout and thank you page. For Facebook, you need to give us your Facebook conversion pixel code and we will add the correct tracker for your pixel.
Example of tracking URL for Facebook:
https://www.facebook.com/tr?id=101501591356150&ev=Purchase&cd[value]=$AMOUNT&cd[currency]=USD&noscript=1
Google Analytics tracking for an ActivityHero widget - If you want to enable cross-domain linking for conversions on the ActivityHero widget there are a few additional steps that need to be followed on your end.
Copy and paste below code in the head tag of your page and make sure it’s executed on all the pages:
<script>
var _customTask = function () {
// customTask Builder by Simo Ahava
//
// More information about customTask: https://www.simoahava.com/analytics/customtask-the-guide/
//
// Change the default values for the settings below.
// iframeDecorator: Configuration object for decorating any iframe with cross-domain parameters when this customTask is run. NOTE! Increasingly inefficient with today's browsers blocking third-party cookies - please read the article linked to below.
// https://bit.ly/2LUoWFf
var iframeDecorator = {
selector: 'iframe.ah-iframe',
attempts: 10,
intervalMs: 1000,
useAnchor: false
};
// DO NOT EDIT ANYTHING BELOW THIS LINE
var readFromStorage = function (key) {
if (!window.Storage) {
// From: https://stackoverflow.com/a/15724300/2367037
var value = '; ' + document.cookie;
var parts = value.split('; ' + key + '=');
if (parts.length === 2) {
return parts.pop().split(';').shift();
}
} else {
return window.localStorage.getItem(key);
}
};
var writeToStorage = function (key, value, expireDays) {
if (!window.Storage) {
var expiresDate = new Date();
expiresDate.setDate(expiresDate.getDate() + expireDays);
document.cookie = key + '=' + value + ';expires=' + expiresDate.toUTCString();
} else {
window.localStorage.setItem(key, value);
}
};
var globalSendHitTaskName = '_ga_originalSendHitTask';
return function (customTaskModel) {
window[globalSendHitTaskName] = window[globalSendHitTaskName] || customTaskModel.get('sendHitTask');
// iframeDecorator
if (typeof iframeDecorator === 'object' && typeof iframeDecorator.selector === 'string' && typeof iframeDecorator.attempts === 'number' && typeof iframeDecorator.intervalMs === 'number') {
var _id_decorateTimer;
var _id_count = 0;
var _id_ga = window[window['GoogleAnalyticsObject']];
var _id_tracker = _id_ga.getByName(customTaskModel.get('name'));
var _id_decorateIframe = function () {
var _id_iframe = document.querySelector(iframeDecorator.selector);
if (_id_iframe !== null && /[?&]_ga=/.test(_id_iframe.src)) {
window.clearInterval(_id_decorateTimer);
return;
}
if (_id_iframe === null) {
_id_count += 1;
if (_id_count === iframeDecorator.attempts) {
window.clearInterval(_id_decorateTimer);
}
return;
}
window.clearInterval(_id_decorateTimer);
_id_iframe.src = (new window.gaplugins.Linker(_id_tracker)).decorate(_id_iframe.src, iframeDecorator.useAnchor);
};
_id_decorateTimer = window.setInterval(_id_decorateIframe, iframeDecorator.intervalMs);
}
// /iframeDecorator
customTaskModel.set('sendHitTask', function (sendHitTaskModel) {
var originalSendHitTaskModel = sendHitTaskModel,
originalSendHitTask = window[globalSendHitTaskName],
canSendHit = true;
try {
if (canSendHit) {
originalSendHitTask(sendHitTaskModel);
}
} catch(err) {
originalSendHitTask(originalSendHitTaskModel);
}
});
};
};
</script>
- When you want to invoke this customTask in your trackers, find where you are creating the tracker and make the following change:
ga('create', 'UA-XXXXXXX-X');
ga('set', 'customTask', _customTask()); // <-- Add this right after creating the tracker
ga('require', 'linker'); // enable linker plugin
ga('linker:autoLink', ['activityhero.com']); //specify activityhero.com in the auto link domains
ga('send', 'pageview');
- Now if anyone visits a page your website utm tracking params and then add items in the cart on ActivityHero widget embedded on your website and then make the purchase. Attributed source/campaign should be reflected on your Google analytics account.
Enabling linking via Google Tag Manager (GTM)
- Login to your Google Tag Manager account
- Click Variables in the left menu and then click New - Refer screenshot
- From the right side panel choose - Custom Javascript - Refer screenshot
-
Copy and paste below code as value of this variable
function () {
// customTask Builder by Simo Ahava
//
// More information about customTask: https://www.simoahava.com/analytics/customtask-the-guide/
//
// Change the default values for the settings below.
// iframeDecorator: Configuration object for decorating any iframe with cross-domain parameters when this customTask is run. NOTE! Increasingly inefficient with today's browsers blocking third-party cookies - please read the article linked to below.
// https://bit.ly/2LUoWFf
var iframeDecorator = {
selector: 'iframe.ah-iframe,
attempts: 10,
intervalMs: 1000,
useAnchor: false
};
// DO NOT EDIT ANYTHING BELOW THIS LINE
var readFromStorage = function (key) {
if (!window.Storage) {
// From: https://stackoverflow.com/a/15724300/2367037
var value = '; ' + document.cookie;
var parts = value.split('; ' + key + '=');
if (parts.length === 2) {
return parts.pop().split(';').shift();
}
} else {
return window.localStorage.getItem(key);
}
};
var writeToStorage = function (key, value, expireDays) {
if (!window.Storage) {
var expiresDate = new Date();
expiresDate.setDate(expiresDate.getDate() + expireDays);
document.cookie = key + '=' + value + ';expires=' + expiresDate.toUTCString();
} else {
window.localStorage.setItem(key, value);
}
};
var globalSendHitTaskName = '_ga_originalSendHitTask';
return function (customTaskModel) {
window[globalSendHitTaskName] = window[globalSendHitTaskName] || customTaskModel.get('sendHitTask');
// iframeDecorator
if (typeof iframeDecorator === 'object' && typeof iframeDecorator.selector === 'string' && typeof iframeDecorator.attempts === 'number' && typeof iframeDecorator.intervalMs === 'number') {
var _id_decorateTimer;
var _id_count = 0;
var _id_ga = window[window['GoogleAnalyticsObject']];
var _id_tracker = _id_ga.getByName(customTaskModel.get('name'));
var _id_decorateIframe = function () {
var _id_iframe = document.querySelector(iframeDecorator.selector);
if (_id_iframe !== null && /[?&]_ga=/.test(_id_iframe.src)) {
window.clearInterval(_id_decorateTimer);
return;
}
if (_id_iframe === null) {
_id_count += 1;
if (_id_count === iframeDecorator.attempts) {
window.clearInterval(_id_decorateTimer);
}
return;
}
window.clearInterval(_id_decorateTimer);
_id_iframe.src = (new window.gaplugins.Linker(_id_tracker)).decorate(_id_iframe.src, iframeDecorator.useAnchor);
};
_id_decorateTimer = window.setInterval(_id_decorateIframe, iframeDecorator.intervalMs);
}
// /iframeDecorator
customTaskModel.set('sendHitTask', function (sendHitTaskModel) {
var originalSendHitTaskModel = sendHitTaskModel,
originalSendHitTask = window[globalSendHitTaskName],
canSendHit = true;
try {
if (canSendHit) {
originalSendHitTask(sendHitTaskModel);
}
} catch(err) {
originalSendHitTask(originalSendHitTaskModel);
}
});
};
}
-
-
-
- Save variable with name customTask - Refer screenshot
- Add one more variable for Google Analytics settings - Refer screenshot
- Specify your Google Analytics ID
- Expand more settings, click Fields to set, click Add Field button
- Add field - customTask ->
- Add field - allowLinker -> true
- Expand Cross Domain Tracking
- In the Auto Link Domains, enter - activityhero.com
- Click Save on the top right
- From the left menu, click Tags and add a new Tag - Refer screenshot
- Specify GA settings variable -
- Add trigger to execute this tag on all the pages - Refer screenshot
- Save tag
- Test by clicking the preview on the top and then submit your tag
- Now if anyone visits a page your website utm tracking params and then add items in the cart on ActivityHero widget embedded on your website and then make the purchase. Attributed source/campaign should be reflected on your Google analytics account.
-
-
Custom: We just need custom script html and we place this script on ActivityHero business page, activity page, cart page, checkout page, widget and thank you page. Just give us the custom script and we will add the tracking for you.