Google Tag Manager JavaScript variable - update to return last 4 characters

Job ID: 32887592

Budget: $30 – $250 AUD

I've created a JavaScript variable in Google Tag Manager to capture text on a page so that the data is made available to be used in a tag.

The current code capture more text than is required (complete mailing address). I only need the last 4 characters of the returned value. The length of the full returned value is variable meaning a fixed character count reference cannot be used (for example characters 34 to 37 would not work).

I've uploaded the JavaScript being used along with a screenshot of the returned value via the preview mode in Google Tag Manager.

Deliverables:

- update the supplied code so that the returned variable value is the last 4 characters of the full returned text
Related categories: JavaScript Google Tag Management