Help Center - Nine Ad Manager
Breadcrumbs

Google Tag Manager Implementation


Integrating the SDK

Requirements:

  • Google Tag Manager

Supported Platforms

  • Web (Browser)

Data Privacy

Integration

Importing and starting the SDK

Follow the steps below to import and start the SDK. This step is required to use any Pubsuite functionality.


  1. In the Google Tag Manager UI, click Add a new tag.

  2. Click Tag Configuration

  3. Choose Tag Type > Custom > Custom HTML

8H8GBm8ERAj5b7LDcgqQRwLsy1dcP9zTbiVn8RXFtlBLAQ_zCPB07vK1f0cDoh6klVLeM88XwCt7HF5HtJIu_voF6PQJJhMa5-it8KR10hnXHygN5H2loRLUDR4YcdBpac2DqZ7K4m7EFz4AHiRe1yU


  1. Add the Pixel code located in your profile settings to your tag. The below is an example only.

<script>

    function loadScript() {

   if (window.pubSuite) {

     console.log("pubSuite snippet already included");

     return;

   }


 var pubSuiteScript = document.createElement("script");

  pubSuiteScript.type = "text/javascript";


  pubSuiteScript.src = "https://storage.googleapis.com/kochava-web-assets/ps/v1.1.1/pubsuite.js";

  pubSuiteScript.async = true;


  pubSuiteScript.onload = function() {

    var product_id = "YOUR_PRODUCT_ID_HERE";

    var access_token = "YOUR_ACCESS_TOKEN_HERE";


    window.pubSuite.startWithProductId(product_id, access_token);

  };

  document.head.appendChild(pubSuiteScript);

}

loadScript();

</script>



  1. Click the Triggering Box and select All Pages from the menu that appears.

04mVO4tlve-8oGi_YU0tP9j_pyUKiGN1xjirH8MXbEV8mgwn6XxvDpGXeBIJsfaDxl8DFnQzn5efOoD-XM8TRoMwxdP7U5EJneS_hx1gWlF2VK86BrLIm-Wg6ju39aMTk0YFSixRUjGz2rLcRGWz3p4
9g0JW1gpD8zz-tmPbPmw6lhysXTovOGiXbN0gNVanx6oYoXDjupckqsXscETllKaGNUZkLh3kkQQFsYzIw6SMoLCG7WZXyTYZ_u4tdrd5ATdcjkIqkkHGEQKARes2jIU3OoOd4kYbN3ZSL78grPXguY


Note: The final tag configuration should look like this

LIPCNEdeP9FiLvZocyYrRleq2H0_rMjzA-ZTgpSOR95O6laB0x3AcWiO1IFE-tDgR0uERNTV35Q1Bueo_JAgdHnVhDqaDFmTkoP68KccSUKCAOz3K_Pos0z_kV_Ekrw29ian1ms_LcGfMTtiPaocQj8

Verifying the tag

Before publishing the tag, verify that it’s working as expected. 


  1. Preview the changes using the preview button in the upper right corner of the screen.

r08APVWrVjygrkm4Pw2FHLGbh-nqRU5gdHk-iRlJAd3_8alnCHfUn4hYnjIZIp0cl2KsToHokt5XopPqrSfM3DSmo5v-yNXJjllG2SLoHUdeWvfNhtbua6bhkqGLa9FLHZEE8eoGmM6E5x-L6x-Fe70
  1. When the preview window opens, press F12 to open the console. Verify that these messages are present.


Note: Verify that the ‘Started SDK PubSuite…’ message states that you’re using version 1.0.0 or higher.

N4bLfdghwLgk68O75UiGExiimM_tQHxIwssVJDhvFjG7ZbKDZSdymSacYFhBpbAjb0k_22L0NC95Od78enMq0aycGNedkQAG9SHFrFNyVfy4Uf8y4P5UCfEfwF0MfUnTOSwIxKQK4iZpe0sK7TfuFVA

Sending a Page View Conversion

This section explains how to send an automatic page view conversion, on every page, when the page loads.


  1. Open the tag that was created in the section above and copy the following line, inserting your page view conversion name.


window.pubSuite.sendConversion('YOUR-PAGE-VIEW-CONVERSION-NAME')


  1. Paste the line in the following location. The sendConversion call must be after the startWithProductId call, but within the onload function.


-ByzMOdcoTzd6UhwC1TP5O3s_a1nWcPMArJQtsie728t-PxQs-MwuSBht4COnbj4ag4YPEgB4aDc89AP5H8uPyJS3GprZGJiw41cFXZdzgvtq_nwFTFjjXnhX4aAMjNmWujgIQJRP0iYJJPPnHYELh0


  1. Preview the changes again, this time verifying that the following messages are present:

zROHnzgEF1SYLCwOzA1oDm8hKUZYqWLp9o4v2FqaSWkNrZUWtXT6M0V1GuuFUP2C6kGnmnqzdDt58Z4opJj35pv6tLStSdOVEgt1Y2ajNGTsFjVVMWWinANhKiIgF1dYT90pNO3Rt-TCnuAobqAcYE4


Note: Seeing this error at this point likely means that the sendConversion call is outside the onload function. Double check that your sendConversion call is in the correct location.

41mN19WNkpykaX62TOGpebEGr0mloZ81aWLs2Ahb7-V3yCi789gsPQGVeGTNrxezFcleyQu0dn2V9EYiLjek16j6e4X5U_LtR9tjeH0dDljrsTEk0vJgz9dahm4ClUjphFkj5W52kAbh27KuF7cyozI

Note: Seeing a ‘Bad Request’ error message likely means that the conversion name you’re trying to send is either incorrect or has not yet been added to the list of supported conversion names. If you’re sure the conversion name is correct in the tag, contact your CSM about having the name added to the list.

NkCHoRA3b1nFeasm-NvG5Yihf3MYOXKVOFvCgOjiHKvdf_cf58kZXIkReUCtuMN5GLd2YB5KB0BZ0Er23MNGkeD5Bwum2TydhQl6h45MIwSxE9XWxXrPFW1oK2lvfQRV8L6pT9wKhjUTvy6OE0SUdHg


Sending Conversion on Button Click

Send conversion when a user clicks on a button with specific text.

Note: This section only applies if the element being clicked on uses the <button></button> tags in the HTML.


  1. After following the steps above to import and start the SDK, create a new custom HTML tag and add the following script.


<script>

  window.pubSuite.sendConversion('YOUR_BUTTON_CLICK_CONVERSION_HERE')

</script>


  1. Click the Triggering section to add a trigger to the tag.

il7ruRQaFeOGGLxIhJodYCe_AFl0q-a_m7mbAUBC9hV98oSdoc5YY0JEnSSdKgjTaDxLKvGPVR1LTX7XxdKIUg6kUcpYl2_Y62ZH4GDE8KQry_-p9FBMHcmd3pkjiC3MMmCRen2HJeDoXIizgNqX7Ww


  1. Add an All Elements click event. If it’s not available in the first list that comes up, click the blue ‘+’ button in the upper right

N04Xog6RC8ypaai9BKUqkYD5673oln5bV0eMt7Rmf1d5SxqvjNNWt60GnHS0kHRBEG3Z7dJg52ZUMhuV-XevIVxsGkvM3Ubei9VBl9eHV52cxGZQ5FhdF0ffNZ-afV5RCIQ3zYp6Wibrgl_xj5aAwuU


  1. Click the Trigger Configuration section to add a new trigger type, and select All Elements from the new menu that appears

auIBRG3vABkrPMraEzADXQ9qHLrEQE4qjI-3pVyTyrO5i2OBIIcx9LAymIboBbFvf8lzgt1Ke5d5rkqlZEU0TrKkyevry-qgh16oChiy9oBk6rYEEp_kD4yJf-eWVfrWKCCImgqTVzd7pcMpH_bwTe8


  1. Once you’ve added the All Elements click trigger to the tag, change the radio button under This trigger fires on from All Clicks to Some Clicks. 

rnhFF3yStyYSjnqDmMNySAOcA68fMW-Vd2YxT1mZ4qI3tKKnLkqFCbs1V8TSUIhmYGe6SzE5yrlR2NwVV19ZJIGOl0s0K5c0a3VRD6Zivn_Qs07nvC9Vw8jWitgLxb3_KInahm7CrQvwW9OaXHOA_p8


  1. From the left-most dropdown menu, select the ‘Choose Built-In Variable…’ option and select the ‘Click Text’ option from the new menu that pops up.

Ics68AABV7rO0Mp9chOyr85Bf5pjQLVpUky2WJK2Af85WX5Lpp34gA4t51tIDEnq72km0jwpVkr3_DfJSXNic5k0jNNUDAr_2bY4JPm6904whSJjO7CUgifJke5SwkQhZaetrLGNSILoKBqhkdcNIDg
6xbfdEYVLLzf7jYHKkIfedO1DFwrVANLKiENuIeIsYpqTZTXE8Q8qazF708lu8-Wn6yJr6S0nqUd76kSc0cKf3ICJE2JJAgr6CwIm5uqeisxrc_1KHX3X7cICZ-FS51bWU_50IVkK9mU1IVNk5hyfkw


  1. In the center dropdown menu, select equals.

-Mzf-azys1AtKDDQEXPFod-6DiegPDWo2VAv8tYZGiXvQEsJRhHHV-XUSPzyBJhaNnW3Aap8B-aXLNeXVhlqCZjtFscpFMQki72Bf7C1r-7sdjzJwd3JN67hu_TTOSQMmjAYAD9zrsusWYM4VAHRIGY


  1. In the right-most textbox, enter in the exact text of the button that is going to be clicked on by the user. This text box is case-sensitive.


lhWmPbLOCOnCXOt63M5D44_1viNqN0ncaHqgJOyuhoz_SJZxouPEQjilwAqk_w3vQrOgh5uw3VPONQYtvtpmWilWSVJaZd1K88GiDM3YDciYX2l7VmlrzwV1_llMRgYLuxOoenDoO3dEPntCSez2iuY


  1. The final tag configuration should look like this:

nXmAZq5097nKe1yjwzSG01dLrmJudqd5uqes3RLMNYnNEe5lp8PvLhXCcklkRzTEEkYFhcspz1DiAUekzpPwKTknG3VFTUwC6mSQgBkjHD5RfIOz1aspWbkSy3yZh2pYSHNE_jIzpz5ncSiSL7j_rqg


Verify the Button/Input Click Tag

  1. Preview the website using the Preview button as you did before. 

  2. Open the console using F12

  3. Click the button with the text that was entered into the textbox in step 8.

  4. Verify that the following messages appeared in the console after the button was clicked:


8kNYQYbHjFk_NSx1Sbeye1DKkWyVHmlaXyMqS-uMuIdE0KqptzRvVzw2RSHiBF40c9z0yOsy4j058HZ65aqMmSCt_U0f3Sf-jL8Re323d080gjmr65glJc1O8a59IF0xGUqzH1ltPnKu8gH9TSi-WYo


  1. To do further verification, add the following line to the script that starts the SDK


window.pubSuite.setLogLevel('trace')


2rWn30m-5iwmpHrsq2JnPYU1y3z2RWhawOnokxidPZ-Iy8uDr4gPyGUkRf6cMS3oHIUX-SqSoR5sMsgkZlJV_xULkpCNbzvm-1WyhyHKNW0OZzXgJ-ZV-wFHcOCJdSgmfgktTBI8AnkBa-7oaQlninE


  1. In the logs, you can now verify that the name of the conversion you’re trying to send matches what is being sent to the database

zQvkrvMgR0S9Pi65GnrbmARKrvMhBSOTeXSglYKPElhPvb_bCc4Bz4lya9SawGBKGaEaIdelGpYBSEE0nDNMWRuU3Re8Pc8HGA1c3bDkWmwhX06yYrbECShv6ZzbNgDAxKiGEl7V3rB4bhGEOEC_8wk


Note: Seeing this error when the button is clicked could mean a couple of things. Verify that the script matches the script in step 1 of Sending Conversion on Button Click. If that’s correct, verify that you have imported and started the SDK, and that you’ve added the All Pages trigger to the import/start tag.

41mN19WNkpykaX62TOGpebEGr0mloZ81aWLs2Ahb7-V3yCi789gsPQGVeGTNrxezFcleyQu0dn2V9EYiLjek16j6e4X5U_LtR9tjeH0dDljrsTEk0vJgz9dahm4ClUjphFkj5W52kAbh27KuF7cyozI


Note: Seeing a ‘Bad Request’ error message likely means that the conversion name you’re trying to send is either incorrect or has not yet been added to the list of supported conversion names. If you’re sure the conversion name is correct in the tag, contact your CSM about having the name added to the list.

NkCHoRA3b1nFeasm-NvG5Yihf3MYOXKVOFvCgOjiHKvdf_cf58kZXIkReUCtuMN5GLd2YB5KB0BZ0Er23MNGkeD5Bwum2TydhQl6h45MIwSxE9XWxXrPFW1oK2lvfQRV8L6pT9wKhjUTvy6OE0SUdHg


Publishing

If the console logs all look correct when previewing your changes, double check with your CSM that data is coming through on the server. Once you’ve verified that traffic is going through to the server, you’re good to go. Publish the changes in Google Tag Manager using the Submit button. Give the site a minute or two and a refresh before verifying that you’re seeing the most recent changes.

nckDESbagVlD0lGtiXVvazfaIvTKTegRVCEYB4aO1EkvUC8_mrGRVr4pbldMiw0JZ2UwKHIvdJ3B53bhGGzkH7nbEUGGHr2VmE6axg2f0qq_y5iSH2kDbzmzXOnC8IDwr_7sYB1itk5fyok9EaweIjk

Sending Conversion on Input Click

Send conversion when a user clicks on an input with certain text in or on it.

Note: This section only applies if the element being clicked on uses the <input /> tag in the HTML.


  1. Navigate to Variables in Google Tag Manager and click New to add a new User-Defined Variable.

HsSsQbyNOi9Fgv_8-NWuBKyTfahl6B5lHNY0z4sUFjkWB4tzDJZBfmTdlZvDHbYEUiebaPoc4qvL0G14dxFA6czAvMfnl3TEcJK_YwE39eqTjDBbBvWsKvcTeU_LlLgWZmnbKv85UYa8dCxBy1XE-x8


  1. Click the Variable Configuration box to open the Choose variable type menu and select Custom Javascript

nnrGnNjvkMm5ZwkZKXY5FYN0zZ2ZrHu2pfQB7xwJ5V1xOy_Vlh0plJ-6uv4locRHtNA1uxN4NfTASuPD5B9EfC6nzO-9byFvS0TL22T5IQAgxMeGTL0y7uiaF0bobz2G-NAPVZuh7cqEYbqGy4aD8Gk
cSph1Llbl7el_hUZbtmJh_ZpjFRHxJTygJk1hvXG18yN-tdUHu1IlqacFbLoSTr3PZPVUw7cxhB5yBB_DdGhFwkd593K10brQIH6MK5cumJYA-mlX6PIfNVQe-2Z2CxLa2xsYDfJworkUHE5PMsfwb0


  1. Paste this script into the textbox and save the changes. Remember the name of this variable, in this example the name is Input Value.


function() {

  var clickedElement = {{Click Element}};

  if (clickedElement && clickedElement.tagName === 'INPUT') {

    return clickedElement.value;

  }

  return undefined;

}


TSK_A4aaMP2j8kJ1l9PIq7CjsXnw_VFT2yA8OzWcti4ke0P6jGvl9Mme48UGXcvRxXsfQZdewgMUu1ITvOKuBCZ1kz8lmf83_bSsyZjQwxV2OKqVBQarDtUKoUVj3AOvpiBZu5dtw6pCPEflXadiJNs


  1. While still on the Variables menu, make sure that Click Element exists in the list of Built-In Variables. If not, click Configure and check the box next to Click Element.

8p1zM7quOPxHXTYRe13YEdILlQl021uVpQvWXzsqt4nY-5VGd8fA-VqiXdkFutqdjGPOqfmHCSCUVqK2IPeX-vanctCwIuaFTLKQUTCPyQpe6l9HzWqlUjyhBtihTfVCk78li0N1J9Ip4GidUPo3Opk
f2ormxLf4gPgbSSrIYog2j3JuGkiQaLUw_J7uyC8xvGYNyE6AtByZovl4iSHkMIPD4utsusBchaYEULvejQA33R-HAb16Fcq9HOntAb-ucf-O7b1QcqosDpx7YhlNJ1JInAVe0oBref3K_Nq30Kibmc


  1. Navigate to the Triggers menu and click New

SMGln9CsIlwA4IZF3XK2Y0GDdsuWIkiIN3c84w5uqn9RwJqMBbPoeXIbO3Poruo9lo0N1xv8FFL-R6y11mIfhUbFfToeneVikZSH4-9kelBnWoJzN02l55PcT93iIDK3jHuSsL18Er_BpB0f8EZJMnY


  1. Click the Trigger Configuration box and select All Elements from the Choose trigger type menu

x5aF1m5kz-Kx_PVyv1-A0LLzVZjrwwsjzzbB7F38of8UYd9oiCjDlGE3n7kCp4VQHn99FQ_DIekPQBhbyBIwelByYmpW1QTl_hLt6wTHL0fFodL8npYwqZEDdsRKAFQc0NX3Bo01IOW0HDHrDrG1kZw
-wmW63U2IperEaZCPT9G9UbjCBfSEwNtz2gB2Mkleowk7ugbywO0FRgvuTPa1ypR4wRPLP2ZROXyQ3467IkxQFZ_PutmDQwWYq6zQCBsPN0KioYFF1fc4QVHVaWJNPdMW4gAWvdKFr_NPbqet6IyK7w


  1. Change the radio button from All Clicks to Some Clicks

IjZubSQNdoG7EEBzCHiy-NDlJZ_n_OLFBjndA7aDfoET0Ee16ZgFwdm82Una0A-w7d4ugLmM23oyyPJr3f0bjo2ZG1Htz-WEOKH_m21jmiIQZwzfh68CweLn8t4aQp1bn6qangs30GyRmvVkCi7R1Yc


  1. In the left-most drop down, select the name of the variable from Step 3 of this section (Input Value in this example). In the center drop down, select equals and in the right-most text box, enter the text found on the button. This textbox is case-sensitive.

-ZY9zgZJfABdXUikcDn-acTR7hjIUCMjSAW3LTKxGd4EkS0t4wTyo0zHMovSn6bZNp5NkJ7mLr5DiA-JGBR18Y7inGYYZVtEzkeh1n1UFf5jdItEQ9Osi7TGtbfAJuL0Tbs0_jJGGGLZVUfCsmn5W9U


  1. The final trigger should look like this. Remember what you named this trigger.

oTP-3cx0afKwGVNJ8JMWy0IvRtkZX1q6ZTjs30sTBoIVzaqjyedCQfvGwe_jOXKAOiiye5qyh6hdDKly0-Xlr56e2sRAScx93aSOIZIrAa00aQoiJEwfx7CIQ9T4ywzF5T7zcXE1eeEkNX8ofyuleUg


  1. Navigate back to the Tags menu and select or create a new tag, and click the Triggering box.

WK6ctGDn_Pg8CMNVBrc3_G_jPEt3QKO0II_gjcgiu20ttYXzlB-ZUa5YnTwP8nOF6BcKnj2i51IwNLW6yzwViLGmGj1_q2loLSofaTtC099bSIu70J2aVrcE_LWz3q3g7XTpxodYfm1XyXTQSoih4x8


  1. Select your trigger from the Choose a trigger menu that appears. Save all your changes.

V62BdDsInJ1wok3DPJBUVU0pqRSUVJ_HCcnVlRpsPYcw63pu-sI2OOY5FZCSzivCBlsUZPeLwDNj7FR3SxtDHpm0nu9Itc00nDuELa_uXLe48aO9Kl6R2I-j2MYZkV8EqcHNtiQUXNfE89lD8sHVo3c
  1. Verify these changes using the Verify the Button/Input Click Tag section