Account Actions
Visit Axeptio to sign up for Axeptio.
You firstly need a Client ID to start. Find the ID created for your domain under “Project ID” by clicking the settings icon on the top right, or by navigating to https://admin.axeptio.eu/projects/ > “Project Name” > “Integration”.
Theme Actions
If you have set up the Analyzify app before, you need to do some changes to some of the existing codes first. Let’s go over them together.
Log in to Shopify Admin > “Online Store” > “Themes”, then on your current theme, click “Actions” > “Edit code”. Here you will find the GTM configuration codes in your “theme.liquid” and “analyzify-gtm-body.liquid” files. Delete the old code (shown below) and paste the new one.
For Shopify Plus stores ,his action also needs to be done in the “checkout.liquid” & “analyzify-gtm-checkout.liquid” files. (If you can’t see the checkout files, then this means they are not activated. Activate them first, then paste the code.)
Once you are done here, head to “Settings” > “Checkout” > “Order status page”, and paste the new code into your “Additional scripts” (Plus stores don’t need to do this!).
Old Code:
<!-- Google Tag Manager -->
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','{{GTM Container ID}}');
</script>
<!-- End Google Tag Manager -->
New Code:
<script>
window.adsbygoogle = window.adsbygoogle || [];
window.dataLayer = window.dataLayer || [];
function gtag() {
window.dataLayer.push(arguments);
}
// Axeptio use the same technique. _axcb holds the
// callback functions that will be executed when
// our lib is loaded
window._axcb = window._axcb || [];
// we pause ad requests by default
// https://support.google.com/adsense/answer/9042142
window.adsbygoogle.pauseAdRequests = 1;
// first we need to push a "js" command to the queue. This will
// register the exact time of the DOM being ready
// as stated here: https://developers.google.com/analytics/devguides/collection/gtagjs
gtag("js", new Date());
// this must be the first thing to be sent to the dataLayer
// cf. https://developers.google.com/gtagjs/devguide/consent#configure_default_behavior
// "call the gtag('consent', 'default', ...) command on every page
// of your site before any commands that send measurement data
// (such as config or event)."
gtag("consent", "default", {
ad_storage: "denied",
analytics_storage: "denied",
personalization_storage: "denied"
});
// after that we wand to update the consent
// when the user gives his/her consent
window._axcb.push(function (axeptio) {
// now that axeptio is loaded, we add completion
// handler to execute when the user give his/her consent.
// this will also happen when we parse the axeptio_cookie
// which contains the preferences of a user
axeptio.on("cookies:complete", function (choices) {
// if you renamed your vendors in Axeptio's admin panel
// change the content of these variables.
var gaVendorName = 'google_analytics';
var adsVendorName = 'Google_Ads';
var consentSettings = {
/*
This option should be updated to denied when ad service is added.
*/
ad_storage: "granted",
analytics_storage: "denied"
};
var shopify_tracking = false;
if (choices[gaVendorName]) {
consentSettings.analytics_storage = "granted";
// We decided to send a manual pageview to make sure
// we do not lose the first visit tracking information
//gtag("send", "pageview");
shopify_tracking = true;
}
// console.log(choices.hasOwnProperty(gaVendorName));
// console.log(choices.hasOwnProperty(adsVendorName));
if (choices[adsVendorName] || choices.hasOwnProperty(adsVendorName) == false) {
consentSettings.ad_storage = "granted";
shopify_tracking = true;
} else {
//When ad_storage is set to 'denied', Google tags will not create or save cookies.
//However, you can optionally elect to pass information through URL parameters
//across pages in order to improve measurement quality.
gtag("set", "url_passthrough", true);
window.adsbygoogle.requestNonPersonalizedAds = 1;
}
// Finally, we update the Google Consent Mode variable to reflect
// the choice of the user
gtag("consent", "update", consentSettings);
window.dataLayer.push({ "event": "analyzify_axeptio_consent_update" });
if (window.Shopify.hasOwnProperty("customerPrivacy")) {
if (window.Shopify.customerPrivacy.hasOwnProperty("setTrackingConsent")) {
window.Shopify.customerPrivacy.setTrackingConsent(shopify_tracking, function () { console.log('Analyzify Axeptio: Shopify tracking is now ' + shopify_tracking) });
}
}
// Ads can be resumed.
window.adsbygoogle.pauseAdRequests = 0;
});
});
</script>
<!-- Axeptio -->
<script>
window.axeptioSettings = {
clientId: "{{ Axceptio Client ID }}"
};
(function (d, s) {
var t = d.getElementsByTagName(s)[0], e = d.createElement(s);
e.async = true; e.src = "//static.axept.io/sdk.js";
t.parentNode.insertBefore(e, t);
})(document, "script");
</script>
<!-- End Axeptio -->
<!-- Google Tag Manager -->
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || []; w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : ''; j.async = true; j.src =
'https://www.googletagmanager.com/gtm.js?id=' + i + dl; f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '{{GTM Container ID}}');</script>
<!-- End Google Tag Manager -->
On the files you’ve entered the new code, change these variables:
- {{Axeptio Client ID}} → Axeptio Domain Group ID
- {{GTM Container ID}} → GTM Container ID
GTM Container Actions
Open the Analyzify app, head to the “Analyzify GTM Container” step in the Setup phase, and download the related JSON file by clicking on the “Download My GTM Container (GDPR Enabled)” button.
Head to your GTM account and open the GTM container you’ve used in the {{GTM Container ID}} field. Click “Admin” > “Import Container”.
Click on “Choose container file” and select the JSON file you’ve just downloaded. Choose “New” as your workspace and name it as you wish (we used “Analyzify GDPR” for the title 🙂 ).
Lastly, choose “Merge” as your import option, and choose “Overwrite conflicting tags, triggers, and variables.”.
Once you see a report for your tags and all the rest, click “Confirm”.
Choose your new workspace from the main menu, then head to “Admin” > “Container Settings”. At the end of the page, click on “Enable consent overview” under the “Additional Settings”. Don’t forget to SAVE!
Click back to “Workspace”, then on the left-side menu, click “Folders” > ”#00 - Settings & User Values”. Make sure the values in these variables are correct, and if they are not, enter the correct values. Be extra careful to double-check the values in:
- constant - Google Analytics 4 (GA4) Measurement ID (G-)
- constant - Google Ads - Purchase - Conversion Label
- constant - Google Ads Account ID / Conversion ID
Open GTM’s “Preview” mode, enter your website’s URL and view your website. If the popup banner appears and no other GTM tags are being fired other than the “Analyzify Log” when you select nothing or deny cookies, then everything is a-okay :)!
You can now submit the changes on your container by clicking “Publish”.
PS. If other tags are being fired (without your intention), you can contact our support team.
After you publish, you’ll see a popup banner saying “A new container version is available”. Click on “Update Workspace” on the banner, then select “Update ”, and you can make this new workspace your default workspace.
GTM records all the changes you make on your container as a new version. So if you run into any problems, you can always choose an old version under the “Versions” tab on the main menu and contact our support team for further help.
As a final step, head to your Shopify Admin > “Online Store” > “Preferences”, and under the “Customer privacy” section, choose the “Collected after consent” option and SAVE.