Follow these steps to implement the Click2Buy conversion tag in your Google Tag Manager Web container.
Before starting, ensure that:
- You have a Google Tag Manager Web Container installed on your website.
- Your website pushes purchase data to the
dataLayer(Standard GA4 Ecommerce schema recommended). - You have received your unique Retailer Key from Click2Buy.
- Download the
template.tplfile sent as attachment, or from this repository. - Open your Google Tag Manager web container.
- In the left sidebar, click on Templates.
- In the Tag Templates section, click New.
- Click the three dots (⋮) in the top right corner and select Import.
- Select the
template.tplfile you just downloaded. - Click Save and close the template editor.
- Go to Tags and click New.
- Click Tag Configuration and look for Click2Buy tag for retailers in the list.
- Enter your Click2Buy Retailer Key (provided by Click2Buy).
- Data Source:
- Keep it as Standard if you follow the GA4
ecommerceschema. - Select a Custom Variable if your purchase data is stored in a different Data Layer variable.
- Keep it as Standard if you follow the GA4
- Click on the Triggering section below the Tag Configuration.
- If you already have a trigger for your purchase event, select it. Otherwise, follow these steps to create a new one:
- Create a new trigger (click the
+icon). - Choose Custom Event as the trigger type (at the bottom of the list).
- Event Name: Enter
purchase(or the specific name of your conversion event). - Name the trigger (e.g.,
Event - Purchase) and click Save. - Save your Tag.
If your website uses a Content Security Policy (CSP), you must whitelist the following domains to ensure the Click2Buy tag works correctly:
- Script Loading:
script-src rs.clic2buy.com - Cookie Access (Iframe):
frame-src t.clic2buy.com - Data Collection:
connect-src analytics.clic2buy.com
Alternatively, you can whitelist our root domain for all directives: *.clic2buy.com.
Example CSP header:
Content-Security-Policy: script-src 'self' rs.clic2buy.com; frame-src 'self' t.clic2buy.com; connect-src 'self' analytics.clic2buy.com;or
Content-Security-Policy: script-src 'self' *.clic2buy.com; frame-src 'self' *.clic2buy.com; connect-src 'self' *.clic2buy.com;- Click the Preview button in GTM to launch the Tag Assistant.
- Complete a test purchase on your website.
- In the Tag Assistant window, check that the Click2Buy GTM Web Tag has fired.
- Open your browser console (F12) and type
window.C2B.q. You should see your transaction data in the queue. - In the Network tab of your browser, verify that the script
rs.clic2buy.com/retailers/YOUR_KEY.jsis successfully loaded.
Once you have verified the tag is working correctly, click Submit in GTM to publish your changes to the live site.