Google Tag Manager
Track conversions on your site through Google Tag Manager.
Use the Specify Advertiser template in Google Tag Manager (GTM) to load the browser SDK and track conversions.
Send consent decisions, visitor identities and conversion events through Google's data layer using window.dataLayer.push(). If your app already sends this information, reuse your existing GTM variables and triggers.
Manual setup
1. Import the template
Download template.tpl, import it into your GTM workspace, and save it as Specify Advertiser.
2. Initialize the SDK
You will need an advertiser key. Start with a development key.
Under Tags, create a tag using Specify Advertiser:
| Field | Value |
|---|---|
| Action | Initialize |
| Advertiser key | Your development key, starting with sak_ |
| API URL | https://spfsrv.com |
| Trigger | Initialization - All Pages |
This tag runs on every page load and automatically loads the Specify browser SDK from https://spfsrv.com/sdk/advertiser.js.
3. Connect consent
Pass your consent manager's answer for advertising on every page load, and whenever it changes. It decides only whether Specify's cookie is used.
Under Variables, create a Data Layer Variable:
| Field | Value |
|---|---|
| Name | Specify cookie consent |
| Data Layer Variable Name | specify_cookie_consent |
| Data Layer Version | Version 1 |
Create a Specify Advertiser tag:
| Field | Value |
|---|---|
| Action | Update cookie consent |
| Cookie consent | {{Specify cookie consent}} |
| Trigger | Custom Event with event name specify_consent |
In your app, send the visitor's answer to the data layer. Replace cmp and its methods with your consent manager's API:
window.dataLayer.push({
event: 'specify_consent',
specify_cookie_consent: cmp.getConsent().advertising
});
cmp.onConsentChange((consent) => {
window.dataLayer.push({
event: 'specify_consent',
specify_cookie_consent: consent.advertising
});
});Send true for accepted and false for declined.
4. Identify the visitor
Identify the signed-in user and any connected wallet, on every page load.
Create a Data Layer Variable:
| Field | Value |
|---|---|
| Name | Specify identity |
| Data Layer Variable Name | specify_identity |
| Data Layer Version | Version 1 |
Use Version 1 so a new list of wallet addresses replaces the previous list in the data layer.
Create a Specify Advertiser tag:
| Field | Value |
|---|---|
| Action | Identify user or wallets |
| User ID or wallets | {{Specify identity}} |
| Trigger | Custom Event with event name specify_identify |
When a visitor signs in, send the user ID your app uses for them. Send it again on every page load while they're signed in. Use the same ID on your server, and don't use an email address.
window.dataLayer.push({
event: 'specify_identify',
specify_identity: user.id
});When a visitor connects a wallet, send its address:
window.dataLayer.push({
event: 'specify_identify',
specify_identity: walletAddress
});Give each person their own ID.
Create another Specify Advertiser tag for sign-out:
| Field | Value |
|---|---|
| Action | Reset identity (logout) |
| Trigger | Custom Event with event name specify_reset |
When the visitor signs out, send this event before identifying another user:
window.dataLayer.push({ event: 'specify_reset' });5. Capture conversions
Create a Data Layer Variable:
| Field | Value |
|---|---|
| Name | Specify event name |
| Data Layer Variable Name | specify_event_name |
| Data Layer Version | Version 1 |
Create a Specify Advertiser tag:
| Field | Value |
|---|---|
| Action | Capture event |
| Event name | {{Specify event name}} |
| Trigger | Custom Event with event name specify_capture |
Send the event after the action succeeds. For example, send signup after the account has been created:
await createAccount(form);
window.dataLayer.push({
event: 'specify_capture',
specify_event_name: 'signup'
});Here, specify_capture tells GTM to run the tag. The tag reads specify_event_name and sends signup to Specify. Keep using the same name for the same action.
If your server confirms the conversion, such as a completed payment, send the event from your server. Keep steps 1 to 4 on your site.
6. Check it works
Use a development key in the tag you created in step 2. Open GTM's Preview, enter your site's URL and connect. Tag Assistant shows which tags run as you use your site.
Open Developer Tools → Network in your browser. Check that:
https://spfsrv.com/sdk/advertiser.jsloads.- Requests to
spfsrv.com/v1/identifyandspfsrv.com/v1/eventsreturn status200when you identify a visitor or send a conversion.
A tag can succeed in GTM before Specify receives the request. Check the network response to confirm Specify accepted it. Development keys never record events.
When you're ready to go live, replace the development key with a production key and publish the container.
Network requirements
If your site has a Content Security Policy, add https://spfsrv.com to script-src so the SDK can load, and to connect-src so it can send requests.
Let the browser send requests directly to Specify. Routing them through your backend prevents Specify from recognizing visitors who came from your ads.