Specify docs

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:

FieldValue
ActionInitialize
Advertiser keyYour development key, starting with sak_
API URLhttps://spfsrv.com
TriggerInitialization - All Pages

This tag runs on every page load and automatically loads the Specify browser SDK from https://spfsrv.com/sdk/advertiser.js.

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:

FieldValue
NameSpecify cookie consent
Data Layer Variable Namespecify_cookie_consent
Data Layer VersionVersion 1

Create a Specify Advertiser tag:

FieldValue
ActionUpdate cookie consent
Cookie consent{{Specify cookie consent}}
TriggerCustom 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:

consent.js
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:

FieldValue
NameSpecify identity
Data Layer Variable Namespecify_identity
Data Layer VersionVersion 1

Use Version 1 so a new list of wallet addresses replaces the previous list in the data layer.

Create a Specify Advertiser tag:

FieldValue
ActionIdentify user or wallets
User ID or wallets{{Specify identity}}
TriggerCustom 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.

identity.js
window.dataLayer.push({
  event: 'specify_identify',
  specify_identity: user.id
});

When a visitor connects a wallet, send its address:

wallet.js
window.dataLayer.push({
  event: 'specify_identify',
  specify_identity: walletAddress
});

Give each person their own ID.

Create another Specify Advertiser tag for sign-out:

FieldValue
ActionReset identity (logout)
TriggerCustom Event with event name specify_reset

When the visitor signs out, send this event before identifying another user:

logout.js
window.dataLayer.push({ event: 'specify_reset' });

5. Capture conversions

Create a Data Layer Variable:

FieldValue
NameSpecify event name
Data Layer Variable Namespecify_event_name
Data Layer VersionVersion 1

Create a Specify Advertiser tag:

FieldValue
ActionCapture event
Event name{{Specify event name}}
TriggerCustom Event with event name specify_capture

Send the event after the action succeeds. For example, send signup after the account has been created:

signup.js
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.js loads.
  • Requests to spfsrv.com/v1/identify and spfsrv.com/v1/events return status 200 when 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.

Next steps

On this page